I have my HTML page with a lot of forms inside. I would like just to send a post request with a form and I would like to change the aspect only of a button without rerendering the whole page after the invocation of a router.post function server-side. How can I do that?
Here is my code:
{{#if alreadyapplied}}
<input type="hidden" name="idJob" value="{{id}}">
<br><br>
</div>
<button type="input" class="btn btn-danger">Already applied</button>
{{else}}
<form method="POST" action="/users/applynow">
<input type="hidden" name="idJob" value="{{id}}">
<input type="hidden" name="email" value="{{x.utente.email}}">
<br><br>
</div>
<button type="input" class="btn btn-primary">Apply Now</button>
</form>
{{/if}}
On the server side, I've got a router.post("/applynow") function that handles the post request. It should handle more or less just like a "like" to a post of facebook.