Send ajax request

前端 未结 2 1121
说谎
说谎 2021-01-16 05:06

Hello i have such code

2条回答
  •  萌比男神i
    2021-01-16 05:54

    The submit button will immediately submit the form it is in, and the browser will leave the page (and the JavaScript execution environment from which the Ajax request is being made).

    Cancel the default behaviour of the form submission when you want to use JavaScript instead.

    onclick="sbt(); return false;"
    

    (I'd look at using a modern approach to event binding instead of onclick attributes though).

提交回复
热议问题