In your line of code here:
var comid = $('#usercomment').children().attr('class');Because you don't specify the child to get, you will always end up with the class of the first child in the set. It looks like you want to get the class of the div that the clicked link is in. To do that you need to start at the clicked element and work your way up. Something like this should do it for you:
- function sendpoint(action, theID)//vote data article
- {
- jjdata = 'val='+action+'&comid='+theID;
- $.ajax(
- {
- type: 'post',
- url: 'commentpoints.php',
- data: jjdata,
- success:function(result){ alert(theID);}
-
- });
-
- return false;
- }
- $('.commentp').click(function()
- {
- sendpoint(1, $(this).parents("div").attr("class"));
- });
-
- $('.commentm').click(function()
- {
- sendpoint(-1, $(this).parents("div").attr("class"));
- });
Hope that helps
Dave