Skip to content

Instantly share code, notes, and snippets.

@gurkanakdeniz
Last active January 5, 2019 11:51
Show Gist options
  • Save gurkanakdeniz/840d79f23ed960bea64b9e8e35b2108b to your computer and use it in GitHub Desktop.
Save gurkanakdeniz/840d79f23ed960bea64b9e8e35b2108b to your computer and use it in GitHub Desktop.
Simple jQuery AJax
function sendData(userId, url) {
$.ajax({
type : "POST",
contentType : "application/json",
url : url,
data : userId,
dataType : 'json',
cache : false,
beforeSend: function() {
// loading vs
},
success : function(result) {
// success
},
error: function(jqXHR, textStatus, errorThrown) {
// error
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment