javascript - jquery ajax requests backend data. How to send it to the backend after modification? Can anyone please explain the general process? It would be better if there is an example. Please.
大家讲道理2017-05-18 10:55:34
0
4
553
The data is obtained using ajax through the interface provided by the background. How to transfer it to the background after the page is modified?
Call the background interface through get or post to get the data. The data is usually a json string object. Convert it into a json object that can be compiled by js. Use the method in the json object in js instead of using eval to parse and assign the data to your Then operate the page to change the page data. Afterwards, these changed data will be obtained and converted into data and sent to the background. As for whether the background requires string or object format, it depends on the background needs
<form>
First name:<input type="text" class="firstname">
Last name:<input type="text" class="lastname">
</form>
<button id = 'get'>获取</button>
<button id = 'post'>发送</button>
The background gives you a query interface, and it must also provide a submission interface, and then use ajax to request it
Call the background interface through get or post to get the data. The data is usually a json string object. Convert it into a json object that can be compiled by js. Use the method in the json object in js instead of using eval to parse and assign the data to your Then operate the page to change the page data. Afterwards, these changed data will be obtained and converted into data and sent to the background. As for whether the background requires string or object format, it depends on the background needs
Just send it the way you received it