prevent refresh of page when button inside form clicked

前端 未结 13 2131
终归单人心
终归单人心 2020-11-22 04:58

I have an issue while using buttons inside form. I want that button to call function. It does, but with unwanted result that it refresh the page.

My simple code goes

13条回答
  •  生来不讨喜
    2020-11-22 05:37

    I was facing the same problem. The problem is with the onclick function. There should not be any problem with the function getData. It worked by making the onclick function return false.

提交回复
热议问题