简体   繁体   中英

Better to use data from table on page or from a pre-made javascript variable - PHP/Javascript

I found a few questions that were close, but not quite what I needed, so I'm sorry if this has already been asked.

I have a page with a table filled in with PHP using data from a database. The user can select a row in the table and it will auto fill the data from that row into an edit section farther down the page.

My question is, when filling the edit fields, is it better to pull the data straight from the table or have PHP save the same data as the table in a javascript variable ahead of time and pull it from that?

When you want to edit the data you must access from the database and fill up the form, not by the js code cause it's bad practice.

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