Skip to main content

Bug Tracker

Side navigation

#8484 closed bug (invalid)

Opened March 09, 2011 01:11PM UTC

Closed March 11, 2011 06:03PM UTC

Last modified March 14, 2012 06:32PM UTC

Jquery AJAX call not working on Chrome and Safari

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

Jquery AJAX call not working on Chrome and Safari

Attachments (0)
Change History (5)

Changed March 09, 2011 02:05PM UTC by rwaldron comment:1

component: unfiledajax
owner: → 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.

Changed March 10, 2011 06:41PM UTC by comment:2

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...

Changed March 10, 2011 11:02PM UTC by comment:3

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

Changed March 11, 2011 06:03PM UTC by jaubourg comment:4

resolution: → invalid
status: pendingclosed

Changed March 29, 2011 04:51PM UTC by anonymous comment:5

Replying to [ticket:8484 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.