Reputation: 37
Ive got the following question and im trying to figure out the answer:
You can find the following code here: http://7.testaddress.com/test.php Do you think the code will work, explain?
$.get('http://1.testaddress.com/ajax/remote.php?id='+id, responseCallback);
Is the answer no it wont work because its not located at the same address?
Upvotes: 0
Views: 70
Reputation: 4978
I believe JQuery has a type of ajax request called JSONP ... which would enable you to do cross domain ajax requests.
http://api.jquery.com/jQuery.getJSON/
Upvotes: 0
Reputation: 751
Yes it wont work because it is from a different sub-domain. At the bottom of the bottom of the jQuery documentation for the Get method there's this little chestnut:
Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol.
Upvotes: 3