How do you override an existing html form to use jquery to post the form?

前端 未结 3 1903
孤独总比滥情好
孤独总比滥情好 2021-02-05 13:23

I have a simple form that I am currently posting back to the server to update a nickname. What jquery code do I add (without changing the form) so that the page will not refresh

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-05 14:07

    You need to use jQuery to bind to the "submit" event and prevent the default action. It would be a little more efficient if your form and nickname input used id's in addition to their names:

    
    

提交回复
热议问题