I’ve been using this to load another page, and just using their example :
$("#links").load("/Main_Page #jq-p-Getting-Started li");
However I want to run a function when the load is successful, and a different one if it fails, unfortunately the description on the callback says:
The function called when the ajax request is complete (not necessarily success).
How do I make sure the load was successful?
Thanks.
You might try using the more detailed $.ajax() method call. This will give you more fine-grained control over the AJAX call (but it also requires a bit more work than a simple .load().) It will allow you to call different functions based on whether your call returns success or error.
Check out: http://docs.jquery.com/Ajax/jQuery.ajax#options for documentation on this function. If you click the “Options” tab on that page, you will get a full listing of the parameters that you can pass to the $.ajax() function.