#7694 closed bug (duplicate)
JSONP doesn't use Accept-Header application/json
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | 1.6 |
Component: | ajax | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If using $.getJSON() or $.ajax() with datatype jsonp or with datatype json and callback=? in the url, the Accept Header of the request is set to */* instead of application/json.
In my case this forces the REST server to respond with application/xml.
The same problem was issued in Ticket #6551, but it was set to invalid. I think this is a valid bug. So I create a new ticket for this.
Change History (5)
comment:1 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
Additionally, the correct way to address a bug that has been closed is to post a re-open request ON THAT TICKET with a valid, reduced test case. #6551
comment:3 Changed 12 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:4 Changed 12 years ago by
Component: | unfiled → ajax |
---|---|
Resolution: | → duplicate |
Status: | reopened → closed |
Note: See
TracTickets for help on using
tickets.
Thanks for taking the time to contribute to the jQuery project by writing a bug report. After checking your report and making up a live test case I came to the conclusion that this is not a bug.
If you check the documentation on jQuery.ajax() you will find several statements related to
jsonp
but I guess this one should explain what happens.Because of the same origin policy it isn't possible to use
XMLHttpRequest
to make a cross-domain jsonp request instead the solution described above is used. This naturally means that jQuery can't possibly influence the accept header as loading the<script>
is handled by the browser. In FF and Chrome thus you will see*/*
as accept header value. So this is a bug on the REST server which should know that request to a certain URL in a certain format should mean "RETURN JSONP".