Hi all I am fairly new to programming. I have been teaching myself php and css and is trying to combine that with some jQuery.
I have a site with a list of items that I want to allow the user to vote up. (www.blueskycouncil.com you can log in with stack/this)
currently I am updating the database by sending this:
<a href=\"idea_karma.php?pagetype=index&karmatype=ideaspace&id={$row['id']}&sort_id=$sort_id\">
to idea_karma.php, check if the user has already voted on it and if not update the database.
This works fine (noob code aside)
Now I want to do it with jQuery instead so that I only update the point rather than the entire page.
Two two of the variables are dynamic (id and sort_id), the specific value get's assigned in a loop.
My question is how to I approach this?
I have tried a couple of things but I can't seem to get them to work.
This is the sript
<script type="text/javascript">
function get() {
$.get('idea_karma.php', {"pagetype": index, "karmatype": ideaspace, "id": id, "sort_id": sortid},
function (output) {
$('#karma').html(output).show();
}};
}
This is where I do the call to the script
<div class=\"karma-btn\">
<a href=\"idea_karma.php?pagetype=index&karmatype=ideaspace&id= {$row['id']}&sort_id=$sort_id\" onClick=\"get();\">
<img src=\"images/btn_lrg_karma.png\" alt=\"Alternative text\">
<span class=\"voted\"><div id="karma">{$row['karma']</div>}</span></a> </div>