javascript - unable to get the data value of ajax on another page -
i'm trying update user votes database. below ajax codes returns correct rating datas. but, i'm unable alert data on page. in car_user_rating.php page have tried echo $post_rating = $_post['performance_rating'];
. doesn't performance_rating data value.
i have checked console. returns rating values (4). i'm confused why doesn't data value?
ajax request
$(function () { $('#form').on('submit', function (e) { performance_rating = $('input:radio[name=rating]:checked').val(); e.preventdefault(); $.ajax({ type: 'post', url: "<?=car_user_ratings?>", data: { performance_rating: performance_rating }, success : function(data){ alert(performance_rating) }, }); }); });
you should alert data
pass in success: function()
like
success : function(response){ alert(response); },
Comments
Post a Comment