Jquery 不通过AJAX传递值的单选按钮

Jquery 不通过AJAX传递值的单选按钮,jquery,html,ajax,forms,radio-button,Jquery,Html,Ajax,Forms,Radio Button,有人知道为什么不回显选中复选框的值吗 Javascript代码: <script src="jquery.min.js" type="text/javascript"></script> <script src="jquery.js" type="text/javascript"></script> <script src="jquery.form.js" type="text/javascript"></script> &

有人知道为什么不回显选中复选框的值吗

Javascript代码:

<script src="jquery.min.js" type="text/javascript"></script>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.form.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
<!--
// wait for the DOM to be loaded 
$(document).ready(function()
{
    // bind 'vgsForm' and provide a simple callback function 
    $('#vgsForm').ajaxForm(function()
    {
        $('#Suggestion').load('process_answers.php');
    }); 
});
这一点得到了回应:

$\u获取:已选择数组():

谢谢你的帮助

丹尼尔

这里是我得到JavaScript代码的地方


我需要额外的JavaScript代码才能工作吗?

看来HTML和内联JS代码都有问题。 请为您的表单尝试以下代码:

<div id="Questions">
<form id="vgsForm" action="process_answers.php" method="POST" >
   <label><input type="radio" name="q1option" value="Less than 16" />Less than 16</label><br />
   <label><input type="radio" name="q1option" value="16 or more" />16 or more</label>
   <input type="submit" value="Submit" />
</form>
</div>
希望有帮助

echo('$_GET: '.print_r($_GET, true));

//Get Question 1
if (isset($_GET['q1option'])) 
{
    $q1option = $_GET['q1option'];
} 
else 
{
    $q1option = NULL;
}

echo("Selected: ".$q1option);
<div id="Questions">
<form id="vgsForm" action="process_answers.php" method="POST" >
   <label><input type="radio" name="q1option" value="Less than 16" />Less than 16</label><br />
   <label><input type="radio" name="q1option" value="16 or more" />16 or more</label>
   <input type="submit" value="Submit" />
</form>
</div>
<html> 
<head> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script> 
    <script src="http://malsup.github.com/jquery.form.js"></script> 

    <script> 
        // wait for the DOM to be loaded 
        $(document).ready(function() { 
            // bind 'vgsForm' in order to upgrade form to use ajax 
            $('#vgsForm').ajaxForm(function() { 
                alert("Form was sent successfully."); 
            }); 
        }); 
    </script> 
</head> 
echo('$_POST: '.print_r($_POST, true));    
//Get Question 1
if (isset($_POST['q1option'])) 
{
    $q1option = $_POST['q1option'];
} 
else 
{
    $q1option = NULL;
}

echo("Selected: ".$q1option);