Bug Tracker

Ticket #6557 (closed bug: wontfix)

Opened 4 years ago

Last modified 3 years ago

ajax async: false not honored for remote script loading

Reported by: gucki Owned by:
Priority: Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: ajax, async, synchronous Cc:
Blocking: Blocked by:

Description

$.ajax({ type: 'GET', url: ' http://api.recaptcha.net/js/recaptcha_ajax.js', dataType: 'script', async: false, success: function() { alert('a'); } }) alert('b');

The alertt'(b') gets fired before alert('a') which should never happen. Looking into the source it seems that the 'async' option is never used when $a.ajax detects s.dataType === "script" && type === "GET" && remote. See line 5062 of jquery.js

Change History

comment:1 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to wontfix

Remote scripts are not handled by XMLHTTPRequest, since XHR cannot be used for cross-domain access. Instead a script tag is injected into the page.

I've closed this as wontfix, but it's really cantfix because of the technologies involved.

comment:2 Changed 4 years ago by dmethvin

I've updated the documentation for $.ajax to clarify that async: false cannot be used for cross-domain requests.

Note: See TracTickets for help on using tickets.