Last active
June 2, 2019 18:26
-
-
Save intruxxer/8144513 to your computer and use it in GitHub Desktop.
Format of AJAX with POST type using jQuery
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
$.post(url, { comment: text }, function(data) { | |
alert(data); | |
}); | |
//or | |
$.ajax(url, { data: { title: text1, comment: text2 }, | |
type: "POST", | |
beforeSend: function() { | |
alert("before send"); | |
}, | |
error: function() { | |
alert("error"); | |
}, | |
success: function(data) { | |
alert(data); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment