Javascript 更改单选按钮的事件以从mysql表中获取值,不起作用

Javascript 更改单选按钮的事件以从mysql表中获取值,不起作用,javascript,php,jquery,mysql,Javascript,Php,Jquery,Mysql,pricegetter.php的代码 jQuery(document).ready(function(){ $("#qty1").change(function(e) { var quantity = $(this).val(); $.ajax({ url: 'pricegetter.php', type: 'POST', data: {quantity: quantity},

pricegetter.php的代码

jQuery(document).ready(function(){    
$("#qty1").change(function(e) {
    var quantity = $(this).val();
        $.ajax({
            url: 'pricegetter.php',
            type: 'POST',
            data: {quantity: quantity},
            success: function(result) {
                $('#price').val(result);
            }
        });

});
});
include(“config.php”);
$q=mysql\u查询(“从产品中选择费率,其中数量=”。$\u POST['quantity'.'”);

如果(mysql_num_rows($q),您可以像在ajax中一样使用逗号分隔的值发送多个数据

<input type='text' name='price' id='price'/>

但是代码根本不起作用。我上面写的代码不起作用。我将尝试你的代码latar,但请帮助我更正代码。没有错误,只是我没有得到结果。你在成功中得到了什么
result
?@Sourav Sarkar我建议你首先检查js,如果它到达ajax调用。使用console.log,从顶部开始然后深入嵌套函数。是否检查了js控制台中的错误?
<input type='radio' value='".$row['qty']."' name='qty1' id='qty1'/> ".$row['qty'] ."  ".$row['unit'] />
<input type='text' name='price' id='price'/>
data: {quantity: quantity,price:price},