I want to call the PHP variable "rate number" as "phpvalue" in jQuery. But the alert of "phpvalue" does not give any output and the alert of "num3" gives "NaN" as the output.
Here is my PHP code.
$jsqla = mysql_query("select id,name,rate_score,rate_number,video_image from products where genre='$genre' limit 0,5");
while($jrowa = mysql_fetch_assoc($jsqla)){
$arate_num = $jrowa['rate_number'];
}
Here is my jQuery code.
$(function(){
$(document).ready(function(e) {
var $stars = $('.input-star-rate');
$stars.bind('change', function() {
var phpvalue = "<?php echo $jrowa['rate_score']; ?>";
alert(phpvalue);
var num3 = parseInt(phpvalue, 10);
alert(num3);
});
});
});
Here is my HTML code.
<input class="rating form-control input-star-rate" id="<?php echo $rateid; ?>" name="rating" value="<?php echo $ratea; ?>" data-min="0" data-max="5" data-step="0.3" data-size="xs" style="display: none; text-align: center;"/>