www.webdeveloper.com
Results 1 to 2 of 2

Thread: use a json file to retrieve json object from server and display data in table

  1. #1
    Join Date
    Mar 2012
    Posts
    3

    use a json file to retrieve json object from server and display data in table

    I am very new to programming with jQuery and I am trying to retrieve a JSON object from a json file I have locally and display the data in a table within the webpage. I have looked at several different forums for this but all of my code so far has got errors within firebug.

    This is my code as of now:

    <head>
    <title>json retrieval</title>

    <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    </head>
    <body>
    <table id="table">
    <tr>
    <td></td>
    <td></td>
    </tr>
    </table>
    <script>
    $.getJSON("dataRetrieval.json",function(data){
    $.each(data,function(index, d){
    //append data to your table as rows
    $('#table').append(
    '<tr>' +
    '<td>' + d.row1entry1
    '<\/td>' +
    '<td>' + d.row1entry2
    '<\/td>' +
    '</tr>'

    );
    });
    });

    </script>

    </body>
    </html>


    I am pretty sure that I am way off and I get this error in firebug:
    missing ) after argument list
    [Break On This Error]

    '<\/td>' +


    Does anyone out there have any ideas that might be helpful? Keep in mind that I am a newb

  2. #2
    Join Date
    Mar 2012
    Posts
    11
    Plus signs at the end of your variables might help.

    HTML Code:
    '<td>' + d.row1entry1 +
    '<\/td>' +
    '<td>' + d.row1entry2 +

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles