i am using php,mysql,jquery. My case is that
step 1 : i generate 10 list items
step 2 : on click of each item more data about that item is to be displayed
As i can get all the data needed from database for the 10 items in step 1 itself ,should I pass all the data as serialized form input with each list item using ajax for step 2 .
OR
should i send a minor part through ajax and expand the data by querying for each onclick event?
Which is the best way to do?
Either way should work it just depends on the amount/ size of the data.
If you think the extra information is too large or that the page is loading too slow, I would go with the second option of ‘sending the list items and create them first, then when one is clicked use ajax to get its information’.
If there isn’t a lot of information I would use the first option as this will reduce the time for the extra information to load when a user click the list item.