whats faster, more efficient, loading a js file with arrays or populating arrays from tables
Posted
by
Leigh
on Stack Overflow
See other posts from Stack Overflow
or by Leigh
Published on 2012-04-12T23:25:46Z
Indexed on
2012/04/12
23:28 UTC
Read the original article
Hit count: 266
I am rebuilding an ecom site where the product data is stored in a multidimensional JS array that gets loaded on page load. This data is constantly being accessed with JS due to the nature of the site, to update prices based on user selections. There are many options that affect final price.
From a programming standpoint, a DB table is much easier to maintain and update than are JS arrays, and since I am porting the site over to PHP and MYSQL, I have been considering moving these arrays into tables.
So, would it be better to populate an array from the DB on load so that the pricing data is always available to the JS, or stay with hard coded JS files? I considered getting data via ajax as needed, but since this site has to constantly update pricing with user interaction, I have pretty much ruled that out.
How would you handle it?
© Stack Overflow or respective owner