Skip to content

Instantly share code, notes, and snippets.

@rnjailamba
Created March 1, 2016 05:33
Show Gist options
  • Save rnjailamba/dbdfdc54996a48294ff4 to your computer and use it in GitHub Desktop.
Save rnjailamba/dbdfdc54996a48294ff4 to your computer and use it in GitHub Desktop.
Node JS - Send AJAX POST data and read from Node/Express js router
// SEND OTP
// ==============================================
router.post('/sendOTP',function(req, res){
console.log('body: ' + JSON.stringify(req.body));
}
var data = {};
data.title = "title";
data.message = "message";
$.ajax({
url:"/users1/sendOTP",
type: 'POST',
async: true,
data: JSON.stringify(data),
contentType: 'application/json',
context: this,
cache: false,
processData: false,
success: function(response) {
},
error: function(response) {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment