title: PHP MYSQL like button
body: <p>Hi i have made a like button for a commenting feed that i have but every time i click it it reloads the page i would like to make it so that it dose not reload the page. i cant find the answer to my question anywhere. i understand that i would have to use javascript or AJAX but as i do not know how to code in that i am stuck.  </p>
  
  <p>This is on the page where my commenting feeds are. the name of the page is member-index.php</p>
  
  <pre><code>&lt;a href=\"like-exec.php?id=".$rows['ID']."&amp;members_id=".$_SESSION['SESS_MEMBER_ID']."\"&gt;like&lt;/a&gt;
  </code></pre>
  
  <p>and this is on the page that executes the code (like-exec.php) </p>
  
  <pre><code>&lt;?php
  require('../config/connect.php');
  require('../config/config.php');
  
  $sql = "UPDATE comments set `like` = `like`+1 where `ID` = '$_GET[id]'";
  $result=mysql_query($sql);
  
  
  $con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
  
  mysql_select_db("likes", $con);
  
  mysql_query("INSERT INTO likes (members_id, comm_id) VALUES(".$_SESSION['SESS_MEMBER_ID'].", $id)");
  
  
  mysql_close($con);
  header("location: success.php");
  
  ?&gt;
  </code></pre>
  
  <p>after that code has finished it gets sent to susses.php that then redirects it to member-index.php.</p>