I have one service that returns the correct data in chrome but fails for firefox and ie9. GET seems to return 200 OK, but still ends with an error callback. I get data via backbonejs (with jquery.getJson and with ajax I get the same result). I get the same result when I try to get data from a remote server or locally.
Chrome: version 23.0.1271.64 m FF: 16.0.2 IE9: 9.0.8112.16421
FOS:
[OperationContract] [WebInvoke(Method = "GET", UriTemplate = "/getData/{name}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] List<Names> getData(string name);
serviceUrl:
"http://serverABC:4000/myService.svc/getData/test"
javascript selection: via trunk or jqueryGetJson ():
$.getJSON("http://serverABC:4000/myService.svc/getData/test", function () { alert("success"); }) .success(function () { alert("second success"); }) .error(function (result) { console.log('error:', result); })
result: "http: // serverABC: 4000 / myService.svc / getData / test 200 OK 70ms"
headers:
Response Headers Cache-Control private Content-Length 6544 Content-Type application/json; charset=utf-8 Date Fri, 16 Nov 2012 14:09:46 GMT Server Microsoft-IIS/7.5 Set-Cookie ASP.NET_SessionId=s3aguluzip0dw135glbxlwwf; path=/; HttpOnly X-AspNet-Version 4.0.30319 X-Powered-By ASP.NET Request Headers Accept application/json, text/javascript, */*; q=0.01 Accept-Encoding gzip, deflate Accept-Language en-US,en;q=0.5 Connection keep-alive Host svgwbip93:4000 Origin http://localhost:51280 Referer http://localhost:51280/Default.aspx?ReturnUrl=%2f User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0
debugging result:
readyState 0 responseText "" status 0 **statusText "error"** abort function() always function() complete function() done function() error function() fail function() getAllResponseHeaders function() getResponseHeader function() overrideMimeType function() pipe function() progress function() promise function() setRequestHeader function() state function() statusCode function() success function() then function() toString function()
Answer: - is empty (this is most likely the problem (but, as I mentioned in Chrome, I get the correct json data)
EDIT 1: I tried to get a raw answer with a violinist, and I get JSON. The big question is why the callback drops to error. Here is my raw answer:
HTTP/1.1 200 OK Cache-Control: private Content-Length: 29 Content-Type: application/json; charset=utf-8 Server: Microsoft-IIS/7.5 Set-Cookie: ASP.NET_SessionId=kuv3g0r2dgmu5bpaoayj5lic; path=/; HttpOnly X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Fri, 16 Nov 2012 19:32:58 GMT {"PlatformDrawingsResult":[]}
I checked json - it seems to be good, so that could be a problem .... hmm. I forgot to mention that I also use requirejs (not sure if this will bring some light, ..)
Cheers, Miro