Form post request and storing data received

2019-07-18 22:22发布

I have a very simple form making a post request on submit:

<form action="/data" method="post">
      <div class="someclass">
         <label for="username">Username: </label>
         <input type="text" id="username" name="username" placeholder="placeholder">
     </div>
     <input type="submit" value="Send" />
</form>

The request goes through, server receives it, sends back a response, and I land on a different page displaying the actual response. Instead, I would just like to store the response in a variable. Is there any way to do this with a <form> without using the XMLHttpRequest object to make the ajax call?

In case it matters (I don't think it should). The server is a node server running on express.js.

0条回答
登录 后发表回答