best way to store php data on a page for use with javascript/jquery?

Posted by Haroldo on Stack Overflow See other posts from Stack Overflow or by Haroldo
Published on 2010-03-16T12:33:38Z Indexed on 2010/03/16 12:36 UTC
Read the original article Hit count: 169

Filed under:
|
|

Ok, so im trying to work out the fastest way of storing data on my page without slowing the page load:

  • I need to store information in the page to be later used by jquery.
  • My page is an events page and i want to attach data to each event anchor.
  • there are 100+ events to attach data to.

The events anchors are created with a php loop, so i could create the data elements within this loop using either

  1. use un-semantic tags ie *rel="some_data"*
  2. create a jquery.data() for each iteration of the loop

or i could run the loop again, separately, this time inside script tags with jquery.data();

would really appreciate any thoughts on this!

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery