Need help returning value

Need help returning value

Hi,

I'm having a hard time figuring out how to return a value to a div.

I have made this "like" script, so people can press a link, to like an article. (I call it stab instead of like - just fyi)




The link is like this:

  1. <a href="stab.php?id='.$r['aid'].'" class="stabit" title="Stab it!">

This is my script:

  1. <script type="text/javascript">
  2. $("a.stabit").click(function(event) {
  3. event.preventDefault();
  4. $.get($(this).attr("href"), function(data) {
  5. $('#stabs_value').html(data);
  6. });
  7. });
  8. </script>

That calls the php file:

  1. $aid = $_GET["id"];
  2. mysql_query("UPDATE jdd_stabit SET stabs = stabs + 1 WHERE aid = '$aid'") or die(mysql_error());

  3. $result = mysql_query("SELECT stabs FROM jdd_stabit WHERE aid = '$aid'") or die(mysql_error()); 
  4. $row = mysql_fetch_array( $result );
  5. $stabs = $row['stabs'];

  6. echo $stabs;


Can you please help me how to return the value $stabs to a div called:

  1. <div class="stabs_value"></div>

Thanks in advance
Br
Morten