SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    563
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to change cell data ?

    Hi,

    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. ?

    Please help.

    Thanks.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,683
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Tapan View Post
    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. ?
    You can use .parseJSON() to convert the JSON data string in to an actual object, and then depending on the structure of it, use .each() to process each piece of data, where you can use jQuery to create your elements and then either .replaceWith() or .replaceAll() command to replace the old contents with the newly updated.
    Last edited by paul_wilkins; Oct 3, 2012 at 00:36.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •