I’m wondering which is the better, more efficient way to store information once it is in PHP. Assuming the data will come from a PHP variable, and will ultimately be used in javascript:
-
immediately storing as js variable and then using variable in functions
<script type="text/javascript"> var information = "lots and lots and lots of text"; // and then later use...
or
2.. load it in the div and ‘call’ it later using jquery
<div id="whatever" information="lots and lots and lots of text"></div>
and just call the ‘information’ element using jquery
Is one way better? Or am I wasting my time investigating this?
The fastest way is the js variable.
It doesn’t say it’s the best way, that depends on your needs, but it’s the fastest.