How do i stop the form from reloading using Javascript?

后端 未结 5 1134
被撕碎了的回忆
被撕碎了的回忆 2020-12-01 15:18

When a User Submits the form i want to stop the default behavior of the form. ie it should not reload. so that i can perform the AJAX request.

here is the code i use

5条回答
  •  旧巷少年郎
    2020-12-01 15:40

    You should use a return in the onsubmit hanlder of the form. Try this version:

    
    

提交回复
热议问题