Hi guys!
I'm finishing up my profileview for a system I am making for my site.
How do I add a like/dislike function with jQuery that inserts a row in the database, without the page being reloaded? I really suck in jQuery so I don't know what to do..
My code so far:
<?php
echo "
<div class=\"profileStatusbox\">
".htmlentities($myStatuz->status, ENT_QUOTES)."
<br><small>
";
if(mysql_num_rows($getLikes) >= 1){
echo "
".number_format(mysql_num_rows($getLikes))." likes";
}
echo "
<a onclick=\"likeStatus('".$myStatuz->id."')\" title=\"Like this!\">Like :)</a>
";
if(mysql_num_rows($getDislikes) >= 1){
echo "
".number_format(mysql_num_rows($getDislikes))." dislikes
";
}
echo "
<a onclick=\"dislikeStatus('".$myStatuz->id."')\" title=\"Dislike this!\">Dislike! :(</a>
";
echo "
</small>
</div>
";
?>
The database looks like this(two separate tables)
Statuslikes(where a person has liked it)
statusid userid id
Statusdislikes(where a person has disliked it)
statusid userid id
Have I done it all wrong so far, or am I going the right way?
Can somebody please help me make the jQuery code?
Thanks!