www.webdeveloper.com
Results 1 to 2 of 2

Thread: JSON and Javascript

  1. #1
    Join Date
    Aug 2014
    Posts
    1

    Post JSON and Javascript

    using ajax I need to read the json format and convert to table/grid form. No third party framework like

    jquery,dijo used.I need to put the Json format and convert it to table as .js file. so I can place it

    in any application. Is it possible to achieve the way I want.

    I have a bewlow script right now

    Code:
    var JSONObj = { data: "/Customers",	"firstname": "xxxx", "lastname": "xx", "address": "2005" };
        document.write("<h1>JSON with JavaScript example</h1>");
        document.write("<br>");
        document.write("<table>");// cellspacing="1" cellpadding="2" class="" id="myTable" width="400">");
        document.write("<thead> <tr> <th>First Name</th> <th>Last name</th> </tr></thead>");
        document.write("<tbody> <tr> <td>"+JSONObj.firstname+"</td> <td>"+JSONObj.lastname+"</td> 
    
    </tr></tbody></table>");
    Is there any other way to implement this using Ajax? Please help

  2. #2
    Join Date
    Jan 2005
    Posts
    360
    There are hundreds of ways to do this, but first of all, lose the document.write bits, and build your table using the DOM

    I note that you have no actual AJAX call in there - where is your JSON coming from?

Thread Information

Users Browsing this Thread

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

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