Best way to store data for sending via Ajax
What is the best way to store data which should be sent via Ajax using jQuery? I usually utilise:
A hidden
<input />
with my value to be sent:<input type='hidden' value='myValue'>
A link with a 开发者_运维百科
data
attribut:<a href='apage.php' data-val='myValue'>
Note: I do not want to use plugins.
Assuming you mean which is better to store your data, the first way (input hidden with my value to be sent).
This is of course unless you're explicitly using HTML5, which isn't is recommended just yet. If you are, it's completely upto you, although the element metadata/html5 way is probably better!
But this doesn't seem to be anything to do with AJAX than just in-page data storage, am I missing something?
精彩评论