Ticket #1557 (closed bug: fixed)
$.ajax broken on cross-site XMLHttpRequests in Firefox 3
| Reported by: | ted.mielczarek | Owned by: | john |
|---|---|---|---|
| Priority: | major | Milestone: | 1.2.2 |
| Component: | ajax | Version: | 1.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Trying to use jQuery's ajax method on a cross-site XMLHttpRequest fails because script is not allowed to call setHeader on these requests. The attached testcase tries to load http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox&json=1 using $.get, and fails.
Attachments
Change History
Changed 6 years ago by ted.mielczarek
-
attachment
jquery-ajax.html
added
comment:1 Changed 6 years ago by john
- Owner set to john
Throwing this in a try{} block should do the trick.
Changed 6 years ago by davidserduke
-
attachment
jquery_test.html
added
test case with getJSON instead of just get
comment:2 Changed 6 years ago by davidserduke
- need changed from Review to Patch
- Status changed from new to closed
- Resolution set to fixed
- Milestone changed from 1.2 to 1.2.2
Fixed in [3978]. This doesn't appear to have been just an FF3 problem and in fact didn't work in any browser. The fix was to add dataType == "json" as an allowable remote type. Check the changeset for details.
One problem with the above test case is it used $.get instead of $.getJSON. The new test case sets the dataType correctly.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

try to use $.get for cross-site-XHR