Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I make it using ajax, jquery and json ...</p> <h2>in page(A) you make the call ...</h2> <p> <code></p> <pre> $('input[name="find"]').live('click',function(){ if($(this).val()){ $.getJSON('find.php?users=' + $(this).val(), function(data) { var rows= ""; $.each(data.users, function(i,user){ rows+= i % 2 ? '&lt;tr class="flip"&gt;' : '&lt;tr class="flop"&gt;'; ... rows+= '&lt;td&gt;' + user.id + '&lt;/td&gt;'; rows+= '&lt;td&gt;' + user.name + '&lt;/td&gt;'; rows+= '&lt;td&gt;' + user.score + '&lt;/td&gt;'; rows+= '&lt;/tr&gt;'; }); $('#list tbody').html(rows); } }); }); </pre> <p></code></p> <h2></h2> <p>The page find.php or page(B) </p> <pre> <code> &lt;?php $user = $_GET['users'] ; // Search code by field ... // Print de result in JSON format ... ?&gt; </code> </pre> <hr> <h2>return the json data like this ...</h2> <pre> <code> { "action" : "find user", "founds" : "2", "users" : [ { "id" : "33", "name" : "Peter Park", "score" : "343" }, { "id" : "1", "name" : "Clark Kent", "score" : "1200" } ] } </code> </pre> <hr> <p>the page(A) like this ...</p> <hr> <p> <code> <code>&lt;table id='list' &gt;</code><br> <code>&lt;thead&gt;&lt;tr&gt;&lt;th&gt;</code>Id<code>&lt;/th&gt;&lt;th&gt;</code>Name<code>&lt;/th&gt;&lt;th&gt;</code>Score<code>&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;</code><br> <code>&lt;tbdoy&gt;</code><br> <code>&lt;/tbody&gt;</code><br> <code>&lt;/table&gt;</code> </p> <p><code>&lt;input type="text" name="find" value="Find User"&gt;</code><br> </code> </p>
 

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