Skip to content

Instantly share code, notes, and snippets.

@glynrob
Created January 24, 2012 20:28
Show Gist options
  • Save glynrob/1672373 to your computer and use it in GitHub Desktop.
Save glynrob/1672373 to your computer and use it in GitHub Desktop.
$.ajax(
{
type: "POST",
url: "/ajax/autosave",
data: data,
cache: false,
success: function(message)
{
if (message == '1'){ // show success saved
t = setTimeout("autosave()", 60000); // set timer for next autosave
} else if (message == '2'){ // show error
var answer = confirm("Your session has timed out. Please login again to continue")
if (answer){
window.location = "/signin";
}
} else { // an error has occured
t = setTimeout("autosave()", 120000); // set the time for a larger amount
}
//alert(message); // for testing purposes
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment