I’m trying to perform a simple html request using jquery with the code below.
$.get('http://externalsite.com/status.html', function(data) {
if (data == 1) {
//do something
}
else {
//do something else
}
});
I’m using the cross domain request plugin found at http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/
and I added the .js script to my html file, but what’s next? The example uses a #container and a load from google, but I’m lost as to what I do for an html request. It says it works for any .get request, I just don’t know how to do it. Thanks for your help.
You can do whatever you want. Read the jQuery docs for .load() and .get()
:
This example puts the contents of
http://google.comin the HTML element withid="container":This does the same thing but with your example site:
This also does the same thing as above: