title: Getting List Result From JSON Array
body: <p>After getting the first row result from <code>JSON array</code>, I need to print the all result using <code>jquery</code> each method.</p>
  
  <p>here's my syntax</p>
  
  <pre><code> $(document).ready(function () {
  
      $("#btnsearch").click(function() {
      valobj = $('#search_box').val();
      $.getJSON("search.php", { q : valobj }, function(data,result){
          //show result from database
          $.each(data.content, function() {
              $('.toprightsec').append("Title" + data.content[0].title)
                          .append("Intro" + data.content[0].intro_text);
          });
  
          //end show result
      }, JSON);
  });
  </code></pre>
  
  <p>The <code>data.content[0]</code> is showing the first row only with looping. But the data it self not changed. How to solve the <code>data.content[0]</code>.title, so the row is printed like in database?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>After creating some tweak to my function, i have added new feature to show the result using list.</p>
  
  <p>Here's the syntax</p>
  
  <pre><code>$(document).ready(function () {
      //function to get the result from user-input
      $("#btnsearch").click(function() {
          valobj = $('#search_box').val();
          $.getJSON("search.php", { q : valobj }, function(data,result){
              //show result from database
              $.each(data.content, function(index, value) {
                  $("#divContent").show();
                  var li = $("&lt;li&gt;&lt;a&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;/li&gt;");
                  $("#posting").append(li);
                      $("a",li).text(value.title);
                      $("p",li).text(value.intro_text);           
              });
  
              //end show result
          }, JSON);
      });
  </code></pre>
  
  <p>The question is, how i can reset the result from  if, we want to show based on another keyword, so the list is clear if user type new keywords? without refreshing the browser.</p>
  
  <p>thank you.</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <pre><code>  $(document).ready(function () {
      //function to get the result from user-input
      $("#btnsearch").click(function() {
          //clear the div
          $("#divContent").html("");
  
          valobj = $('#search_box').val();
          $.getJSON("search.php", { q : valobj }, function(data,result){
              //show result from database
              $.each(data.content, function(index, value) {
                  $("#divContent").show();
                  var li = $("&lt;li&gt;&lt;a&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;/li&gt;");
                  $("#posting").append(li);
                      $("a",li).text(value.title);
                      $("p",li).text(value.intro_text);           
              });  
              //end show result
          }, JSON);
      });
  </code></pre>