Answer the question
In order to leave comments, you need to log in
How to display message from rest api in view?
Good time of the day. For example, when a user is successfully created using the POST method on the page localhost/api/user , the message {"statusCode":201,"message":"User Saved Successfully"} is displayed.
How can I display this message on the page from where I make a post request to create the most user? The address from which I am sending a POST request to localhost/post. An abstract example, I just want to understand how to implement it. I will be glad to links to mana or examples. Thank you all in advance
Answer the question
In order to leave comments, you need to log in
These are the basics of ajax, make an ajax request to localhost/api/user, get your message and display it on the same page from which you never left.
Or do you mean what you send from the node? It's no different, you pass your message in
res.render('index', {
msg: message
})
I send the request with a regular html form, when the submit button is pressed, it transfers me to api / user, is this also solved through ajax?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question