In the example below, the alert dialog box is not displaying at all. Any ideas why?
$.get('http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Earth%20Day',function(data) { alert("DATA LOADED: " + data); });
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The reason your call is not working, is you are trying to make a cross-domain request with the normal
$.getfunction of jQuery. You need to use$.getJSONand add&callback=?to the url so jQuery will treat it as a JSONP request:You can also write your request this way to be a little more readable. Just remember the
callback=?has to be in the URL and cannot be included in the object literal with the other key/value pairs: