I have the following form:
<form method="post" action="http://domain.com/api.json?param=value"></form>
On submission of this form, this will replace my document with a response from http://domain.com/api.json
.
Is it possible to POST this form, but prevent receiving a response, and keep the existing HTML with the form
?
Send an HTTP 204 No Content response instead of the usual 200 OK response.
You could just use AJAX (XMLHttpRequest in this example) to submit the post
Before hand, if you need. You can grab your param value and encode it:
then the second line would be more like:
Otherwise, any sort of submitting from a
form
will load a page. A hack would be to put it in a iframe thats hidden, and just delete the iframe when done.