<input type="radio" id="radio1" name="radio"><label for="radio1">Choice1</label>
<input type="radio" id="radio2" name="radio" checked="checked"><label for="radio2">Choice2</label>
<input type="radio" id="radio3" name="radio"><label for="radio3">Choice3</label>
</div>
<?php
// if (radio == Choice1){
// include ("file1.php");
// }
// elseif (radio == Choice2){
// include ("file2.php");
// }
// else {
// include ("file3.php");
// }
?>
当我选择"jQuery UI单选按钮"时,我想"包括"一个页面。请用一个小脚本告诉我。我不是jquery或ajax 的专家
最好的方法是在您的无线电盒子上捕捉click
事件。
然后检查是否已检查
如果是,请通过ajax加载内容,即
类似于:
$('input[name=radio]').each(function(){
$(this).bind('click', function(){
... checking and ajax loading ...
});
});
这里有一些链接:
- http://api.jquery.com/bind/
- http://api.jquery.com/jQuery.ajax/
- http://www.w3schools.com/js/js_switch.asp