tapan — 2012-10-02T06:40:12-04:00 — #1
I have a table which has 7 cells. when the page is loaded I pre-populate those table cells which has an ahref and img in it.
I have made a php script also just gives me output as json for next / prev. 7 products.
I just want to know how to use that json data which has url for ahref and url for img picture to replace the content in cells with new data using jquery etc. ?
paul_wilkins — 2012-10-03T00:23:20-04:00 — #2
You can use [.parseJSON() to convert the JSON data string in to an actual object, and then depending on the structure of it, use [url="http://api.jquery.com/jQuery.each/"].each() to process each piece of data, where you can use jQuery to [url="http://api.jquery.com/jQuery/#jQuery2"]create your elements and then either [url="http://api.jquery.com/replaceWith/"].replaceWith() or [url="http://api.jquery.com/replaceAll/"].replaceAll()](http://api.jquery.com/jQuery.parseJSON/) command to replace the old contents with the newly updated.