Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery ajax call successfully running but page not updating
    primarykey
    data
    text
    <p>my jquery ajax call is updating my database but its not updating the page. I m not clear about the success parameter please help</p> <p>jquery:</p> <pre><code>&lt;script type="text/javascript"&gt; function changeStatus(userStatus,userId) { var getParameters = "userStatus = " + userStatus + "&amp;userId = " + userId; $.ajax({ type: 'GET', url: 'blogUsers.php', data: getParameters, success: function() { } }); } &lt;/script&gt; </code></pre> <p>php:</p> <pre><code>&lt;?php if( isset( $_GET['userId'] ) &amp;&amp; isset( $_GET['userStatus'] ) ) { $userId = $_GET['userId']; $userStatus = $_GET['userStatus']; switch( $userStatus ) { case "1": $changeStatus=0; break; case "0": $changeStatus=1; break; default: $changeStatus=""; } $Query = "UPDATE blog_users SET blog_user_status='$changeStatus' WHERE blog_user_id='$userId'"; $Result = mysql_query( $Query ); } ?&gt; </code></pre> <p>this is how the user grid is showing on page:</p> <pre><code>function viewUsers() { $Query="SELECT * FROM blog_users"; $Result=mysql_query($Query); while ($row=mysql_fetch_array($Result)) { $userId=$row['blog_user_id']; $userName=$row['blog_user_name']; $userEmail=$row['blog_user_email']; $userStatus=$row['blog_user_status']; ?&gt; &lt;tr&gt;&lt;td&gt;&lt;?php echo $userId; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $userName; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $userEmail; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php if($userStatus==1){echo "Active";}else echo "Banned"; ?&gt;&lt;/td&gt; &lt;?php $action=""; switch($userStatus){ case "1": $action="Ban User"; break; case "0": $action="Activate User"; break; default: $action=""; } ?&gt; &lt;td&gt;&lt;a href="#" onclick="changeStatus(&lt;?php echo $userStatus; ?&gt;,&lt;?php echo $userId; ?&gt;);"&gt;&lt;?php echo $action; ?&gt;&lt;/a&gt;&lt;/td&gt; &lt;?php } } ?&gt; </code></pre> <p>this is how i call function"</p> <pre><code>&lt;td&gt;&lt;a href="#" onclick="changeStatus(&lt;?php echo $userStatus; ?&gt;,&lt;?php echo $userId; ?&gt;);"&gt;&lt;?php echo $action; ?&gt;&lt;/a&gt;&lt;/td&gt; </code></pre> <p>and thsi is the part that needs to be updated:</p> <pre><code>&lt;table class="tablesorter" cellspacing="0"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th class="header"&gt;userId&lt;/th&gt; &lt;th class="header"&gt;userName&lt;/th&gt; &lt;th class="header"&gt;userEmail&lt;/th&gt; &lt;th class="header"&gt;userStatus&lt;/th&gt; &lt;th class="header"&gt;Actions&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;?php viewUsers(); ?&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>In actual the <code>$action</code> variable should be changed to Activate user or Bann user on click !</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.
 

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