JQuery's getJSON() not setting Accept header correctly? JQuery's getJSON() not setting Accept header correctly? ajax ajax

JQuery's getJSON() not setting Accept header correctly?


This is not a bug.

Since your call is cross-domain, your browser will not allow you to make XHR calls (same-origin policy). Internally, jQuery is working around this using the "<script> tag hack", to make the cross-domain call (this is the fundemental idea behind the JSONP data type). Since the call is made using the tag, it is simply not possible for jQuery to modify the accepts portion of the header.

jQuery works its magic by hiding these details from you, but unfortunately in this case you seem to be subject to the Law of Leaky Abstractions.


Without seeing your code (which might point us to an obvious solution,) can you try using the standard Ajax function and see if you get different results?

$.ajax({  url: '/what.eva',  dataType: 'json',  data: '{}',  success: callbackFunc});function callbackFunc(result) {   alert(result);} 


This is a bug which has been closed on the jquery website.

http://dev.jquery.it/ticket/6551

There does not appear to be a fix for this yet.