title: jquery + IE 7 & 8 - parse error when getting JSON data
body: <p>I have a few very simple AJAX calls using jQuery.<br>
  My c# webmethods are marked as <code>[ScriptMethod(ResponseFormat = ResponseFormat.Json)]</code>
  and return a correctly-formatted JSON.<br>
  This works great in FF, but goes crazy on IE:<br>
  the error handler is invoked, where the <code>response</code> has <code>status = 200</code> (!!), the <code>responseText</code> is the valid JSON I want to get, and the <code>statusText</code> is <code>"parsererror"</code>.  </p>
  
  <p>I saw somewhere on SO (can't seem to find it again now) that the problem is that IE expects an xml format response, and throws parser exception on anything else.<br>
  the suggested solution was, basically, using the error handler as a success handler:  </p>
  
  <pre><code>$.ajax(
              {
                  url: "SampleScriptService.asmx/Function",
                  type: "POST",
                  data: {},
                  contentType: "application/json;",
                  dataType: "json",
                  success: function (result) {
                      SuccesFunction(result.d);
                  },
                  error: function (e) {
                      if (e.status != 200) {
                          alert("this is a real error");
                      }
                      SuccesFunction(JSON.parse(e.responseText).d);
                  }
              });
  </code></pre>
  
  <p>this seems really hacky to me. Does anybody know of any other solution?<br>
  p.s. things i've already tried: <a href="http://blog.justprofessionals.com/web-design/jquery-json-internet-explorer/" rel="nofollow noreferrer">these</a>, <a href="https://stackoverflow.com/questions/425854/jquery-ajax-request-failing-in-ie#1351389">this</a>, all solutions suggested <a href="https://stackoverflow.com/questions/249692/jquery-wont-parse-my-json-from-ajax-query">here</a> </p>
  
  <p><strong>UPDATE</strong><br>
  not sure whether it's related or not, but IE also gives this strange error-  </p>
  
  <pre><code>Expected ';' Line: 101139813 Char: 5 Code: 0 URI: http://localhost/sample/samplePage.htm
  </code></pre>
  
  <p>needless to say, my htm file contains ~100 lines.<br>
  If I make no ajax calls (and therefore- the above error handler isn't called) then this error does not appear.  </p>