How to have user submit text in form and AJAX it to enter to db and show up on same page?

前端 未结 3 1292
面向向阳花
面向向阳花 2021-01-27 05:58

I want the user to fill it out. Submit it, have it store into the database and then use jquery to have it show up on the same page in front of them. Right now I can get it to se

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-27 05:59

    Here is work flow:

    1) User hits form submit.

    2) You gather necessary information from DOM. You AJAX the information to a server-side script that enters that info into the database.

    3) You use JQuery to insert the information however you want to display it into the DOM.

    4) Remove whatever html you no longer need on the page if necessary.

    In terms of code you are going to want to look at JQuery's ajax or post functions for the AJAX call.

提交回复
热议问题