Page 1 of 1

Ajax Rating

Posted: Wed Mar 02, 2011 3:13 pm
by egturnkey
Hello dear friends,

I've problem with one of ajax rating script that send id value as rating value however i also need it to send another variables which i'm going to store it in database

here is the code if you didn't understand what i've said :confused:

Code: Select all

<script type="text/javascript">
// <![CDATA[
$(document).ready(function(){
$('#loader').hide();
$('#inner').children().click(function(){
var a = $(this).attr("name");
$.post("rating.php?value="+a,{},
function(response){
$('#inner').fadeOut();
$('#inner').html(unescape(response));
$('#inner').fadeIn();
setTimeout("hideMesg();", 2000);
});
});
});
function hideMesg(){
$('.rating_message').fadeOut();
$.post("rating.php?show=1", {},
function(response){
$('#inner').html(unescape(response));
$('#inner').fadeIn('slow');
});
}
// ]]>
</script>
My Problem is with that code at

Code: Select all

var a = $(this).attr("name");
$.post("rating.php?value="+a,{},
it sends name as value from

Code: Select all

<div class="rating_dis" name="<?php echo $k?>" id="<?=$id?>">&nbsp;</div>
Now clear i've both id and name
and i've decide to send name as rating value

now how i can make it also send the value of id ?

here is the php file code which should get the value of name and add it to database

Code: Select all

if($_REQUEST['value']){
$name = $_REQUEST['value'];

$query = "insert into rating (rated, channelid) values ('$name', '$id')";
mysql_query( $query);
}
it is very clear it tame the coming value as $name

so my problem how to send also id ?????????

thanks in advance

Re: Ajax Rating

Posted: Mon Mar 14, 2011 4:19 pm
by mike_ebrahimi123
$.post('rating.php?value="+a+"ID="+id'");