So I am running into this problem. I am trying to use $.get() to interact with a REST application within Drupal 6.16, which uses jQuery 1.2.6
I have a test page on the desktop where I run the following code, and it successfully runs the alert.
url = 'http://api.twitter.com/1/help/test.xml';
$.get(url, function(){alert("WORKING!!");}, 'xml');
When I try to run it within Drupal, however, the alert is never reached. For some reason, the function never gets triggered.
Any ideas?
All I have to say to this is:
Same origin policy
And that’s exactly what you are trying to do. Making a ajax-request to a different domain then where the script is located. Which doesn’t work because the same origin policy prohibits cross-domain-requests.
Check if the offer a jsonp api and read the
jQuery.ajax()documentation how to use/make jsonp cross-domain-requests. Now obviously the alert is never reached as the call doesn’t succeed and jQuery thus doesn’t call the success-callback you specified.