jQuery includes a library that makes ajax calls very simple, example below:
$(document).ready(function() {
$('#example-2').ratings(5).bind('ratingchanged', function(event, data) {
$('#example-rating').text(data.rating);
$.ajax({
url : 'page.php',
type : 'POST',
data : { rating : data.rating },
success : function(response){
console.log("successfull");
}
});
});
});
On the PHP side, you can pick it up with:
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
echo $_POST['rating'];
}
1
solved How to pass data from javascript to php [closed]