title: Jquery Ajax call goes in error callback even I got the response as readyStatus 4 and status 200
body: <p>I have an application using jQuery Ajax call. It is working fine in IE9,firefox ,chrome. In IE 8 ,it goes in error callback even the response as readyStatus 4 and status 200.</p>
  
  <p>The below response I got in Error handler of IE8 </p>
  
  <pre><code>{"readyState":"4","status":"200","statusText":"success"}
  </code></pre>
  
  <p>The below response I got in success handler in rest of browser including IE9</p>
  
  <pre><code>{
      "Status": "Success",
      "Roles": [
          "Developer",
          "RMG"
      ]
  }
  </code></pre>
  
  <p>Below is my ajax code: </p>
  
  <pre><code>$.ajax({
          cache : false,
          type : "POST",
          async : false,
          url : server + "/Login",
          dataType : "json",
          data : requ,
          contentType : "text/json; charset=UTF-8",
          success : function(dr) {
              data = dr;
              console.log("Success "+JSON.stringify(data));
              alert("Success "+JSON.stringify(data));
          },
          error : function(xhr) {
              alert("Error "+JSON.stringify(xhr));
          }
      }); 
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Added this Script:</p>
  
  <pre><code>(function($){
  alert("here0");
  if (!$.support.cors &amp;&amp; $.ajaxTransport &amp;&amp; window.XDomainRequest) {
  alert("here");
    var httpRegEx = /^https?:\/\//i;
    var getOrPostRegEx = /^get|post$/i;
    var sameSchemeRegEx = new RegExp('^'+location.protocol, 'i');
    var htmlRegEx = /text\/html/i;
    var jsonRegEx = /\/json/i;
    var xmlRegEx = /\/xml/i;
  
    // ajaxTransport exists in jQuery 1.5+
    $.ajaxTransport('* text html xml json', function(options, userOptions, jqXHR){
      // XDomainRequests must be: asynchronous, GET or POST methods, HTTP or HTTPS protocol, and same scheme as calling page
      if (options.crossDomain &amp;&amp; options.async &amp;&amp; getOrPostRegEx.test(options.type) &amp;&amp; httpRegEx.test(options.url) &amp;&amp; sameSchemeRegEx.test(options.url)) {
        var xdr = null;
        var userType = (userOptions.dataType||'').toLowerCase();
        return {
          send: function(headers, complete){
            xdr = new XDomainRequest();
            if (/^\d+$/.test(userOptions.timeout)) {
              xdr.timeout = userOptions.timeout;
            }
            xdr.ontimeout = function(){
              complete(500, 'timeout');
            };
            xdr.onload = function(){
              var allResponseHeaders = 'Content-Length: ' + xdr.responseText.length + '\r\nContent-Type: ' + xdr.contentType;
              var status = {
                code: 200,
                message: 'success'
              };
              var responses = {
                text: xdr.responseText
              };
              try {
                if (userType === 'html' || htmlRegEx.test(xdr.contentType)) {
                  responses.html = xdr.responseText;
                } else if (userType === 'json' || (userType !== 'text' &amp;&amp; jsonRegEx.test(xdr.contentType))) {
                  try {
                      alert("JSON");
                    responses.json = $.parseJSON(xdr.responseText);
                  } catch(e) {
                    status.code = 500;
                    status.message = 'parseerror';
                    //throw 'Invalid JSON: ' + xdr.responseText;
                  }
                } else if (userType === 'xml' || (userType !== 'text' &amp;&amp; xmlRegEx.test(xdr.contentType))) {
                  var doc = new ActiveXObject('Microsoft.XMLDOM');
                  doc.async = false;
                  try {
                    doc.loadXML(xdr.responseText);
                  } catch(e) {
                    doc = undefined;
                  }
                  if (!doc || !doc.documentElement || doc.getElementsByTagName('parsererror').length) {
                    status.code = 500;
                    status.message = 'parseerror';
                    throw 'Invalid XML: ' + xdr.responseText;
                  }
                  responses.xml = doc;
                }
              } catch(parseMessage) {
                throw parseMessage;
              } finally {
                complete(status.code, status.message, responses, allResponseHeaders);
              }
            };
            // set an empty handler for 'onprogress' so requests don't get aborted
            xdr.onprogress = function(){};
            xdr.onerror = function(){
  
              complete(500, 'ERROR', {
                text: xdr.responseText
              });
            };
            var postData = '';
            if (userOptions.data) {
              postData = ($.type(userOptions.data) === 'string') ? userOptions.data : $.param(userOptions.data);
            }
            xdr.open(options.type, options.url);
            xdr.send(postData);
          },
          abort: function(){
            if (xdr) {
              xdr.abort();
            }
          }
        };
      }
    });
  }
  
  })(jQuery);
  </code></pre>
  
  <p>But still not working :(</p>