Sort rows with jQuery
<p>I have a list (ordered by <code>id</code>): </p>

<p><strong>MySQL:</strong><br /></p>

<pre><code>ORDER BY id ASC
</code></pre>

<p><strong>Table:</strong> <br /></p>

<pre><code>id       name          value    status
--------------------------------------------------- 
1          david         56         0
2          jack          67         1
3          alex          23         0
4          leah          98         1
----------------------------------------------------
..........
</code></pre>

<p><strong>Question:</strong> <br /></p>

<p>I want to display the rows with status == 1` on the top (I wont use MySQL), How Could I do that with jQuery.</p>

<p><strong>The result should be:</strong> </p>

<pre><code>id         name          value    status 
--------------------------------------------------- 
2          jack          67         1 
4          leah          98         1
1          david         56         0
3          alex          23         0
----------------------------------------------------
..........
</code></pre>

<p><strong>I tried:</strong><br /><br />
<strong>HTML + PHP:</strong></p>

<pre><code>&lt;table&gt;

&lt;?php if($row-&gt;status == 1) { ?&gt;

&lt;tr class="order"&gt;

&lt;?php } else { ?&gt;

&lt;tr&gt;

&lt;?php } ?&gt;


    &lt;td&gt; ...&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p><strong>jQuery:</strong></p>

<pre><code> $('table tr:first').before($('tr.order'));
</code></pre>
