From my Webpage I send an AJAX Post request :
$.ajax({
url:"/test",
type:"POST",
data:{"final":data},
dataType : "json",
success : function(data){
console.log(data);
},
error:function (data) {
console.log(data);
}
});
Which reached my express route:
app.post('/test', function(req, res) {
console.log("reached post")
//business logic
res.render(path.join(__dirname+'/../views/index'), {data: body1});
});
But if Im not wrong, my view HTML response will be returned to the AJAX call which will not be rendered in the browser. How do I go about rendering this response ? Or is there any other method to do this?
via RJP
No comments:
Post a Comment