Skip to content

Instantly share code, notes, and snippets.

@EeroHeroHeino
Last active October 25, 2016 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EeroHeroHeino/2d14f0cce2c8e1dfd3f47491f4d32c29 to your computer and use it in GitHub Desktop.
Save EeroHeroHeino/2d14f0cce2c8e1dfd3f47491f4d32c29 to your computer and use it in GitHub Desktop.
// send GLOBALS.saveData to external server
$.ajax({
url: "https://example.com:8000/post",
error: function(x, err){
callback("Save timed out with "+err);
},
success: function(){
callback(true);
},
type: "POST",
contentType: "application/json",
crossDomain: true,
timeout: 3000, // sets timeout to 3 seconds
data: JSON.stringify(GLOBALS.saveData),
dataType: "json"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment