I handle submit event of my form like so:
events: {
'submit #contactus-form': 'submit'
},
...
submit: function() {
alert("handle");
},
But even though I do it after seeing an alert my page refreshes and this adds to url:
?name=&email=&text=
How do I prevent standard behavior? Leaving only my handler.
This is because you are submiting the for you can use event.preventDefault to prevent this. try this code:-
submit: function(e) {
e.preventDefault();
alert("handle");
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.