#10256 closed bug (invalid)
Cross domain requests using jsonp
Reported by: | stanislav | Owned by: | stanislav |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | ajax | Version: | 1.6.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When you perform a cross-domain jsonp request using jquery and if the server returns the jsonp response using status code != 200 you have the following:
- the registered error callback function tells you that status code is 200
- jquery is unable to parse jsonp - parseerror
The bellow http responses demonstrate the mentioned behavior. The first one is processed correctly instead of the second one.
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 211
Content-Type: application/json
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 12 Sep 2011 15:27:42 GMT
jQuery16306215030491174232_1315841261014({"initData":"bla-bla"})
HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Length: 169
Content-Type: application/json
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 12 Sep 2011 16:49:55 GMT
jQuery16309673461931202953_1315846180861({"error":"Bla-bla"})
Change History (7)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Component: | unfiled → ajax |
---|---|
Owner: | set to stanislav |
Priority: | undecided → low |
Status: | new → pending |
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.
comment:3 Changed 11 years ago by
Status: | pending → new |
---|
I've simply forgot to add: I've got this behavior in IE9 (haven't tested in other browsers yet)
comment:5 Changed 11 years ago by
Status: | pending → new |
---|
Hello, The test could be found here http://jsfiddle.net/F7D7U/6/ Here is some explanation http://clip2net.com/s/1bJGO I'm not really sure that it is an issue at all, but I haven't found any documentation which tells that we can't use status codes <> 200 within jasonp requests. In IE 9 it invokes error callback with textStatus = 'parsererror'
comment:6 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
error(jqXHR, textStatus, errorThrown)Function A function to be called if the request fails [snip] Note: This handler is not called for cross-domain script and JSONP requests.
comment:7 Changed 11 years ago by
IE9 calls it anyway. BTW, is there any possible way to get the response message?
I suppose that the main issue is that jquery doesn't process jsonp correctly in the case of StatusCode != 200.