Form submit using ajax get method to get response back using XMLhttpreq

后端 未结 2 1672
长情又很酷
长情又很酷 2021-01-26 10:31

I have this form that a user choose values from two dropdown menu. The options in select comes from js file and are exchange rates list. I have already created the code that sho

2条回答
  •  萌比男神i
    2021-01-26 11:04

    
    

    When the submit button is clicked, the loadDoc function runs, but before the Ajax response arrives, the form submits and a new page is loaded.

    The new page doesn't including the event handler waiting for the Ajax response.


    Don't use a submit button. Add type="button".

提交回复
热议问题