søndag 24. april 2016

Fields cleared on submit

The data I had registered in the frontend disappeared when I hit Submit.
The consol at the client also gave me the 'Out of memory' error.
I had a form and a submit-button in the form. When the submit-button was clicked, a function was called. To avoid the default action on the form, I had to use event.preventDefault(); in the function.
Another way is to replace the type="submit" with  type="button". Then you should not need this command.


Scriptfile:
$(document).on("click", "#Send", function(event){

         event.preventDefault();
.....

});

HTML-document:
<form ...    >


<input type="submit"   id="Send"...     >
</form>

Ingen kommentarer:

Legg inn en kommentar