Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the sub-child values in HTML tables
    primarykey
    data
    text
    <p>I have a web-service that returns with the below Json format</p> <pre><code>{ "data": [ { "id": 61, "fullName": "second,first", "firstName": "second", "ownerId": 4, "emailId": "skmvilla@gmail.com", "lastName": "first", "isDeleted": "N", "smodifyDate": "July2012", "statusName": "New", "orgId": 20 }, { "id": 62, "fullName": "second,first", "firstName": "second", "ownerId": 4, "emailId": "skmvilla@gmail.com", "lastName": "first", "isDeleted": "N", "smodifyDate": "July2012", "statusName": "New", "orgId": 20 } ], "vprospectMonthlySum": null, "vProspectMonthly": null, "vProspectCount": null } </code></pre> <p>I want the show the above data in a HTML table. So i made a ajax call to the rest service URL &amp; also it returns with the data in my firebug tool.</p> <p>i was not able to print the above data in a html form. below is my html code</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Itaxibook&lt;/title&gt; &lt;h2&gt;Itaxi&lt;/h2&gt; &lt;/br&gt; &lt;div class="table" id="tab1"&gt; &lt;table class="basic-table" id="karthi"&gt; &lt;thead&gt; &lt;tr&gt; &lt;td&gt;&lt;label &gt;Id&lt;/label&gt;&lt;/td&gt; &lt;td align="left"&gt;&lt;input type="text" id="id" class="medium" name="" value=""&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label&gt;OrgId&lt;/label&gt;&lt;/td&gt; &lt;td align="left"&gt;&lt;input type="text" id="orgId" class="medium" name="" value=""&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label&gt;FullName&lt;/label&gt;&lt;/td&gt; &lt;td align="left"&gt;&lt;input type="text" id="fullName" class="medium" name="" value=""&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label &gt;EmailId&lt;/label&gt;&lt;/td&gt; &lt;td align="left"&gt;&lt;input type="text" id="emailId" class="medium" name="" value=""&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label&gt;ModifyDate&lt;/label&gt;&lt;/td&gt; &lt;td align="left"&gt;&lt;input type="text" id="smodifyDate" class="medium" name="" value=""&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;/table&gt; &lt;/div&gt; &lt;/form&gt; &lt;/head&gt; &lt;/html&gt; &lt;/html&gt; </code></pre> <p>Below is my AJAX code </p> <pre><code>$.ajax({ type: "GET", //GET or POST or PUT or DELETE verb url: "http://88.80.223.163:8080/lumiin-service/lumiin/control/vprospects", // Location of the service //contentType: "application/json", //data: JSON.stringify(params), dataType: "json", success: function (data) {//On Successfull service call var txtStr = '&lt;table class="datatable"&gt;&lt;title="Prospect"&gt;&lt;thead&gt;&lt;tr&gt; &lt;th&gt;Id&lt;/th&gt; &lt;th&gt;OrgId&lt;/th&gt; &lt;th&gt;FullName&lt;/th&gt; &lt;th&gt;EmailId&lt;/th&gt; &lt;th&gt;ModifyDate&lt;/th&gt; &lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;/title&gt;'; for(var i = 0; i &lt; data.length; i++) { txtStr += '&lt;tr class="gradeA"&gt; &lt;td&gt;&lt;a class="edit_row" href="#tab2" onclick="showDetails(\''+data[i].id+'\');"&gt;'+data[i].id+'&lt;/a&gt;&lt;/td&gt; &lt;td&gt;'+data[i].orgId+'&lt;/td&gt; &lt;td&gt;'+data[i].fullName+'&lt;/td&gt; &lt;td&gt;'+data[i].emailId+'&lt;/td&gt; &lt;td&gt;'+data[i].smodifyDate+'&lt;/td&gt; &lt;/tr&gt;'; } txtStr += '&lt;/tbody&gt;&lt;/table&gt;'; $("#tab1").html(txtStr); document.getElementById('karthi').innerHTML = txtStr; }, error: ServiceFailed// When Service call fails }); </code></pre> <p>i am getting the error as <strong>Type error document.getelementbyId is null</strong></p> <p>Any help will be much appreciated </p> <p>Thanks Karthie</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload