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

后端 未结 2 1673
长情又很酷
长情又很酷 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条回答
  •  心在旅途
    2021-01-26 10:59

    I have solved it with help of Quentin. You guys can use this code, but remember to remove all of html that you have after your php code. it causes this error

    Uncaught SyntaxError: row 23 Unexpected token < in JSON at position 4 at JSON.parse () at XMLHttpRequest.xhttp.onreadystatechange

    if you get this, remove all of your html or anything you have after you echo the data you want to send to JS

提交回复
热议问题