title: XMLHttpRequest cannot load the url Origin null is not allowed by Access-Control-Allow-Origin
body: <p>The <strong>json response</strong> is in </p>
  
  <pre><code>{"userName":"clevermeal835","userRole":"Participant"}
  </code></pre>
  
  <p>I am getting  alert message as success but while reading the response I am getting the error as </p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load the url Origin null is not allowed by Access-Control-Allow-Origin.</p>
  </blockquote>
  
  <p>If i run the code from command prompt by --disable-web-security I am getting response<br>
                   The below is code.   </p>
  
  <pre><code>&lt;html&gt;  
  &lt;head&gt;  
  &lt;meta charset="UTF-8"&gt;  
  &lt;script type="text/javascript" src="Scripts/jquery-1.4.2.min.js"&gt;&lt;/script&gt;  
                       &lt;script&gt;  
          $(document).ready(  
          function() {  
          $("#jsonpbtn2").click(function() {  
              var uid = "clevermeal835";  
              var pwd = "Welcome_1";  
              var userType = "participant";  
              var surl="http://localhost:8080/RESTlet_WS/MobiSignIn/{\"userName\":\""+uid+"\",\"password\":\""+pwd+"\",\"userType\":\""+userType+"\"}/";  
                  $.ajax({  
                      type : 'GET',  
                      contentType: "application/json; charset=utf-8",  
                      url : surl,  
                      dataType : 'json',  
                      headers : {Accept : "application/json","Access-Control-Allow-Origin" : "*"},  
                      crossDomain : true,  
                      success :SucceedFunc ,
                      error : function(data, textStatus, errorThrown) {
                              console.log("error"+' '+JSON.stringify(data) + ' ' + textStatus + '  ' + errorThrown);  
                      }
                      });  
                      function SucceedFunc(data) {
                          alert("success");
                          var userName = data.userName;
                          alert(userName);
                      }
                      });  
                  });  
      &lt;/script&gt;   
      &lt;/head&gt;  
      &lt;body&gt;  
      &lt;input id="jsonpbtn2" type="submit" value="button" /&gt;  
      &lt;/body&gt;  
      &lt;/html&gt;    
  </code></pre>