Submit form without reloading page [duplicate]
You can’t do this using forms the normal way. Instead, you want to use AJAX. A sample function that will submit the data and alert the page response.
You can’t do this using forms the normal way. Instead, you want to use AJAX. A sample function that will submit the data and alert the page response.
You can mimic the default jQuery plugin behaviour as follows: Test if the form is valid; if not prevent the default action from occurring using preventDefault(): EDIT: this comes in handy if you want to fine-tune your validation test i.e. validating some controls conditionally.
Angular supports this out of the box. Have you tried ngSubmit on your form element? EDIT: Per the comment regarding the submit button, see Submitting a form by pressing enter without a submit button which gives the solution of: If you don’t like the hidden submit button solution, you’ll need to bind a controller function to the Enter keypress … Read more
In your doSomething() function, pass in the event e and use e.preventDefault().