How do I use beforeSend callback in $.getJSON(cross domain).
More specifically $.getJSON is call is to a YQL service
Like
select * from html where
url=”http://www.yahoo.com”
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 only purpose of beforeSend is to get at the raw XHR object (normally for setting HTTP headers on it). You don’t need it for kicking off spinners and the like. This code here (from @petersendidit):
Is better written like this:
Which means, unless you need any advanced options in jQuery.ajax, your original plan to use jQuery.getJSON is just fine. So you say you want to show a loading GIF, just do this and forget about
beforeSend.