Created
March 31, 2017 13:07
-
-
Save aegiz/4b8c3e0e445a6f0525487be93d368f7c to your computer and use it in GitHub Desktop.
Make AJAX request with 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
var callAjax = function(url, type, data, callback) { | |
$.ajax({ | |
url: url, | |
type: type, | |
data: data, | |
success: function(result) { | |
if(callback) { | |
callback(result); | |
} | |
}, error: function(MLHttpRequest, textStatus, errorThrown) { | |
console.log(errorThrown); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment