我试图通过 Ajax 获取单选按钮字段的值,但它只返回'undefined'。
我在用着:
function fetch_data(id,type)
{
$.ajax({
type: "POST",
async: false,
url: "fetch_data.php",
data: "id="+id+"&type="+type,
success: function(msg){
$("#div1").html(msg);
}
});
}
<select name="data1" id="data1"
onchange="fetch_data(this.value,document.getElementsById('radio1').value"
style=" width:150px;">
<div id="div1"></div>
将替换为“fetch_data.php”页面 div