Code
// ajax
$.ajax({
url: "/process",
type: "POST",
data: $(this).serialize(),
success: function(data) {
if (data.success) {
$container.html("<h2>Thank you!</h2>");
} else {
$container.html("There was a problem.");
}
},
error: function() {
$container.html("There was a problem");
}
});
// app.jsapp.post
app.post("/process", function(req, res){
if(req.xhr || req.accepts("json,html")==="json"){
res.send({ success: true });
} else {
res.redirect(303, "/thankyou");
}
});
however, the result is: There was an arguments!
Open FF, and show
obviously used app.post for request processing, what went wrong? How to solve?