I use the following script to force my server to recache a page, however I want to modify it so it can POST to many pages but use the same success function.
function recache()
{
$.ajax({
type: 'POST',
url: '../units_and_evidence/',
data: 'cache=yes',
success: alert("Reset cache successful")
});
}
How would I provide multiple urls to POST to using the same success function?
Got you, you want jQuery Deferreds.
Basically, the $.AJAX functions in jQuery 1.5 and above return a deferred object.
What happens is once both requests (or all items in the .when() method parameters) are resolved (handled with AJAX automatically for you), the function in the .then() method is executed. There’s more, which you can find in online tutorials or the API docs.