Created
May 29, 2018 13:48
-
-
Save luislobo14rap/c4d1c24420dbdc1e6f9b69294236426d to your computer and use it in GitHub Desktop.
This file contains 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-example.js v1 | |
let obj = { | |
login: 'admin', | |
password: '1234' | |
}; | |
ajax('submit.php', obj, function(status, data){ | |
if(status){ | |
}else{ | |
}; | |
}); |
This file contains 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.js v1 | |
function ajax(url, obj, callback){ | |
$.ajax({ | |
url: url, | |
type: 'POST', | |
data: obj, | |
success: function(data){ | |
if(data == 1){ | |
// success | |
callback(true, data); | |
}else{ | |
// error | |
callback(false, data); | |
}; | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment