Created
September 28, 2015 16:28
-
-
Save galileoguzman/c0d06806b73777162152 to your computer and use it in GitHub Desktop.
Example how to use AJAX function on JQUERY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
type : 'POST', | |
url : 'http://localhost/api/get/all', | |
data : {'token': 'some string'}, | |
dataType: 'JSON', | |
cache : false, | |
beforeSend : function(){ | |
//Before to send request do a animation | |
// ... | |
}, | |
error: function(request, status, error){ | |
// If there is a error do something like show message | |
console.log(request.responseText); | |
}, | |
success: function(response){ | |
// If backend had to send you a response do something | |
// ... | |
console.log(response); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment