简体   繁体   中英

Update select contents without reloading form

I have quite a long form which has many HTML form selects pulling data from MySQL tables - quite often a client will be mid way through filling in the form when they realise that the value they want for department, for example, has not yet been entered into the system so is not in the list.

I have added a link to a simplified popup for adding departments but after it is added it does not appear in the select list as the contents of that select are based on what was available on the load of the page when the initial query ran - how can I get the select to update without having to submit and then edit, without the page refreshing/reloading and without the client losing the data they have currently added?

Thanks

Did read what you are asking, since its too long) But did you try javascript? changing form values after paged loaded is possible only with javascript.

在该弹出窗口上提交表单时,将其与ajax一起保存在数据库中,并作为响应获取插入的数据...然后在ajax成功的情况下,在select中添加新选项(带有返回的数据)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM