Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#8484 closed bug (invalid)

Jquery AJAX call not working on Chrome and Safari

Reported by: Nishant Owned by: Nishant
Priority: undecided Milestone: 1.next
Component: ajax Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:

Description

Jquery AJAX call not working on Chrome and Safari

Change History (5)

comment:1 Changed 9 years ago by Rick Waldron

Component: unfiledajax
Owner: set to Nishant
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists.

comment:2 Changed 9 years ago by alexh@…

I seem to have the same problem, however it's kind of hard to attach a test case, since I can not really pin down the problem:

In my Grails Project I'm using a JSONP call to get ads for my search results. It works fine in Firefox, camino, but in chrome and safari the script tag is injected in the head and nothing happens. No errors are thrown and no request seems to be made (according to the built in developer tools). The URL is fine and even working, if I copy and paste it to the url-address bar. The strangest thing is however it's working for me if I use the exact same scripts, etc. in a static html page and even another JSONP call is working fine altogether. So maybe this might even be a bug in Webkit-browsers and the way they evaluate the script tags? I don't believe that the Grails framework could have anything to do with it, but thats actually the only difference I could see between the two cases.

Browsers tested: Chrome 11.0.696.0, Safari: 5.0.3 Jquery:1.5.0, 1.5.1, 1.4.3

If you need more information I will try to give you as much help as I can...

comment:3 Changed 9 years ago by alexh@…

shame on me... just figured out that I had adblock enabled which blocked the requests once it was running on the server :((

comment:4 Changed 9 years ago by jaubourg

Resolution: invalid
Status: pendingclosed

comment:5 in reply to:  description Changed 9 years ago by anonymous

Replying to Nishant:

Jquery AJAX call not working on Chrome and Safari

Had the same problem. It worked on my localhost but not on the server. Firefox worked fine, chrome safari and IE all had issues with any .get .load or .post ajax call in my code.

It turned out that these browsers block any ajax call that is not made locally due to the 'same origin policy'. In other words, if you use an http://.... .com web address it is not going to work, for security reasons (and probably good ones too... firefox should probably block these types of requests as well).

These browsers will only accept local ajax calls, using relative urls. If you need to gather information from another site, a nice workaround is to create a page using php (or whatever server side language you use) that retrieves this information, then perform an ajax call to that page on your own server to use it in your jquery script.

Note: See TracTickets for help on using tickets.