Side navigation
#14816 closed bug (notabug)
Opened February 18, 2014 02:12PM UTC
Closed February 24, 2014 03:08PM UTC
Last modified March 06, 2014 07:16PM UTC
doing cross-domain syncronous ajax request within a jsonp ajax request - syncronous flag is not respected for the internal requests
Reported by: | tobias.hein@netresearch.de | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.10.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi Guys,
we came across a jQuery problem when doing the following
- do an ajax request from mydomain.com
- get a jsonp-Response like
$.ajax({ url: "anotherdomain.com/someother/MyObject.js", dataType: "script", cache: true, async: false }); var myObject = new MyObject();
Here get an error because the MyObject.js is not loaded although the ajax request is marked as with async:false.
We tried to debug the problem and we also read the manual which says, that jsonp-Requests always will be called with async:true.
but in this case only the first request is a jsonp-Request. so we guess jQuery should respect the configuration of non-jsonp-Requests by e.g. resetting the transportation to non-jsonp.
We found this behavior in jQuery-Version 1.8.3 up to 1.10.1
Attachments (0)
Change History (3)
Changed February 24, 2014 03:08PM UTC by comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
Changed March 06, 2014 08:56AM UTC by comment:2
Hi Guys,
sorry for the embarrasment regarding my bug report. it seems as i has not pointed out the problem well. as i mentioned, we read the manual and there is no doubt that
Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation."
Thats not our problem. the problem is, that we fetch javascript code by a jsonp request. this javascript code executes an independent ajax request. this ajax-request should be executed synchronously - but instead, because its code has been loaded by an asychnronous "jsonp"-request, it is also exectuted asynchronously.
Changed March 06, 2014 07:16PM UTC by comment:3
In your example, you're using a cross-domain "script" request which by its very nature cannot be synchronous since it must use script tag injection.
https://github.com/jquery/jquery/blob/master/src/ajax/script.js#L33-L35
The docs for
async
say: " Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation."