我为网站制作了一个基于 ajax 的表单,它接受用户的输入并将其发送到数据库。所有字段都工作正常,但单选按钮在发送值时出现问题。我的ajax代码是
<script type="text/javascript">
function emp1() {
.....................
xmlhttp.send("firstname=" + firstname.value + "&lastname=" + lastname.value + "&company=" + company.value
+ "&myemail=" + myemail.value
+ "&address=" + address.value
+ "&city=" + city.value
+ "&province=" + province.value
+ "&postalcode=" + postalcode.value
+ "&country=" + country.value
+ "&contact=" + contact.value
+ "&radio1=" + radio1.value
+ "&paymentmethod=" + paymentmethod.value
);
单选按钮的 html 表单代码是
<input type="radio" name="radio1" id="radio1" value="Free Shipping" onclick="emp1();"> Free Shipping<br />
<input type="radio" name="paymentmethod" id="paymentmethod" value="abc" onclick="emp1();">abc
<br />
<input type="radio" name="paymentmethod" id="paymentmethod" value="def" onclick="emp1();" onchange="emp1();">def
<br />
<input type="radio" name="paymentmethod" id="paymentmethod" value="ghi" onclick="emp1();">ghi
任何帮助...... .. thnx提前