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:
- <a href="stab.php?id='.$r['aid'].'" class="stabit" title="Stab it!">
This is my script:
- <script type="text/javascript">
- $("a.stabit").click(function(event) {
- event.preventDefault();
- $.get($(this).attr("href"), function(data) {
- $('#stabs_value').html(data);
- });
- });
- </script>
That calls the php file:
- $aid = $_GET["id"];
- mysql_query("UPDATE jdd_stabit SET stabs = stabs + 1 WHERE aid = '$aid'") or die(mysql_error());
- $result = mysql_query("SELECT stabs FROM jdd_stabit WHERE aid = '$aid'") or die(mysql_error());
- $row = mysql_fetch_array( $result );
- $stabs = $row['stabs'];
- echo $stabs;
Can you please help me how to return the value $stabs to a div called:
- <div class="stabs_value"></div>
Thanks in advance
Br
Morten