Javascript 使用php在数据库中传递js参数值 整体评级:

Javascript 使用php在数据库中传递js参数值 整体评级:,javascript,php,mysql,Javascript,Php,Mysql,如何使用php在数据库中传递js参数值?使用ajax <input class="stars" type="radio" id="star5" onclick="myFunction('Overall rating:',5)" name="rating" value="5" /> <label class = "full" for="star5" title="Awesome - 5 stars"></label> <input class="stars

如何使用php在数据库中传递js参数值?

使用ajax

<input class="stars" type="radio" id="star5" onclick="myFunction('Overall rating:',5)" name="rating" value="5" />
<label class = "full" for="star5" title="Awesome - 5 stars"></label>
<input class="stars" type="radio" id="star4" onclick="myFunction('Overall rating:',4)" name="rating" value="4" />
<label class = "full" for="star4" title="Pretty good - 4 stars"></label>
<input class="stars" type="radio" id="star3" onclick="myFunction('Overall rating:',3)" name="rating" value="3" />
<label class = "full" for="star3" title="Meh - 3 stars"></label>
<input class="stars" type="radio" id="star2" onclick="myFunction('Overall rating:',2)" name="rating" value="2" />
<label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
<input class="stars" type="radio" id="star1" onclick="myFunction('Overall rating:',1)" name="rating" value="1" />
<label class = "full" for="star1" title="Sucks big time - 1 star"></label>
<font  size="4"color="#ffffff">Overall rating:</font>
你也可以检查一下这个答案

单选按钮的Onchange()调用一个ajax函数,该函数将把您的响应存储在数据库中。

我什么都不懂,您想要什么?您能告诉我们您是如何让它工作的吗?函数myFunction(x,y){alert(x);$.post('rating.php',{'category':x,'rating':y},函数(d){alert('hello'+d);})我有一个html代码,在这里我创建一个onclick函数,传递2个参数,然后在js上获得它,我需要传递这些参数值php,这将帮助我插入数据库
function myFunction(yourString, value) {
    $.get('updatePage.php', { 'yourkeyString': yourString, 'yourValue': value }, function (d) { alert('Hello from PHP: ' + d); });
}