Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you have more than one line in result, then you have to -</p> <ol> <li>Loop through it in the callback. You are not looping through it now. You are looping only for alert.</li> <li>Dynamically create a new row in table for each line. You can clone the exiting <code>tr</code> for this using <code>jquery clone</code> method. But replace the <code>id</code> with 'class`.</li> <li>Add data to that row pertaining to the line by modifying innerHtml of each td in the newly created row.</li> <li>Finally, Append the row to the table</li> </ol> <p>HTML - </p> <pre><code>&lt;table id="t"&gt; &lt;tr&gt; &lt;th&gt;Start date&lt;/th&gt; &lt;th&gt;End date&lt;/th&gt; &lt;th&gt;Nights&lt;/th&gt; &lt;th&gt;Currency&lt;/th&gt; &lt;th&gt;Price&lt;/th&gt; &lt;th&gt;Link&lt;/th&gt; &lt;th&gt;City&lt;/th&gt; &lt;th&gt;Country Code&lt;/th&gt; &lt;th&gt;Star Rating&lt;/th&gt; &lt;/tr&gt; &lt;tr class="first"&gt; &lt;td class="from"&gt;&lt;/td&gt; &lt;td class="to"&gt;&lt;/td&gt; &lt;td class="nights"&gt;&lt;/td&gt; &lt;td class="currency"&gt;&lt;/td&gt; &lt;td class="price"&gt;&lt;/td&gt; &lt;td class="link"&gt;&lt;/td&gt; &lt;td class="city"&gt;&lt;/td&gt; &lt;td class="country"&gt;&lt;/td&gt; &lt;td class="stars"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Javascript - </p> <pre><code>success : function(parsed_json) { $.each(parsed_json.Result, function( index, record ) { $row = $('.first').clone(); var from = record['StartDate']; $row.find('.from').html(from); //Similarly repeat the above two lines for other columns //... $('#t').append($row); }); } </code></pre>
    singulars
    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