Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You've got to remember that jQuery and PHP are completely independent of one another, and simply updating data in the database will not update the data on your page until you refresh, as the PHP code will only run when the page first loads, and not after. What you need to do is use your <code>success</code> method in the jQuery ajax call. Change your ajax call to</p> <pre><code>$.ajax({ type:'GET', url:'blogUsers.php', data:getParameters, success:function(data, status, jqxhr) { ... set users in view here ... } }); } </code></pre> <p>What format are you returning the data in from the server here? Is the <code>blogUsers.php</code> returning HTML, or is it returning a JSON array of users? If html, you can simply set the body of your response function to</p> <pre><code>$(".tablesorter tbody").html(data) </code></pre> <p>But I assume you're most likely returning JSON?</p> <p>If you are, then you'll need to generate the HTML from within the success method. Something like this should work :</p> <pre><code>$(".tablesorter tbody tr").remove(); $.each(data, function(user){ $(".tablesorter tbody").append( $("&lt;tr&gt;&lt;/tr&gt;").append( $("&lt;td&gt;&lt;/td&gt;").append( $("&lt;a&gt;&lt;/a&gt;", { href: "#", onclick: "changeStatus(" + user.userStatus ", " + user.userId + ")", text: user.action }) ) ) ) }) </code></pre> <p>This snippet assumes your user objects have the properties name, userId, userStatus, and action, and that the users response is simply an array of user objects.</p> <p>Obviously you'll want to build up the html in the format you want, this will just generate</p> <pre><code>&lt;tr&gt; &lt;td&gt; &lt;a href="#" onclick="updateStatus(status, id);"&gt;Action here&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>But it gives you a rough idea of how it'll work</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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