更改单选按钮的事件以从mysql表中获取值,而不是工作

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);
            }
        });

});
});

code for pricegetter.php

include("config.php");
$q = mysql_query("select rate FROM products WHERE qty= '".$_POST['quantity']."'");
if(mysql_num_rows($q)<=0) echo "none";
else{
$r = mysql_fetch_array($q);
echo $r["rate"];
}

my radio button to fire the event

<input type='radio' value='".$row['qty']."' name='qty1' id='qty1'/> ".$row['qty'] ."  ".$row['unit'] />

my value to be store by a text field.

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

These above code are not working perfectly as expected. please help me to find the error. my php code is working perfectly separately, there is no syntax or field name error.

The aim of my code is, when I select a qty1 radio button, it will give me the price associated with the qty for the particular product. [p.s. I am in my first step of the code. I don't know how to send two value as post action using jquery, so I only send the qty but it is not giving me the price. I will then try to provide productID through the jquery.]

You can send multiple data using comma separated value like in your ajax

data: {quantity: quantity,price:price},