I’m trying to use the jQuery.Get() function to return the contents of a webpage.
Something along the lines of –
var data = $.get("http://mysite...../x.php");
I know the above is wrong, can someone help my out here?
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.
jQuery ajax calls are asynchronous, so you’ll need to do something on the callback of the get.
Also, bear in mind that $.get is just a convenience handler. Even the documentation (http://api.jquery.com/jQuery.get/) indicates that it calls $.ajax. With that in mind, it’s always a better idea to call the method directly, as it’s a couple less calls pushed on to the stack and you save a few CPU cycles.