当我选择单选按钮On或Off以提交输入id =“not”时,我该如何制作?
<label><input type="radio" onClick="*???*" name="shfaq<?php echo $i; ?>" value="1" id="radiobuttonsondazh_0" <?php if($result['live']==1) echo 'checked'; ?> />Po</label>
<label><input type="radio" onClick="*???*" name="shfaq<?php echo $i; ?>" value="0" id="radiobuttonsondazh_1" <?php if($result['live']==0) echo 'checked'; ?> />Jo</label>
<input id="kot" name="soralivetitull" type="submit" value="Shfaq" style="margin-top:1em" onclick="setWTF(this.form.soralivetitull);" />
答案 0 :(得分:1)
你可以用这个来制作一个表格并做一些解释:
W3Schools on form submitting 或者你可以通过ajax提交提交功能:
$.ajax({
url: 'MyURLtoReceivePost',
type: 'POST',
cache : false,
data : data,
contentType: 'application/x-www-form-urlencoded; charset=utf-8',
success: function (response) {
console.log(response);
},
error: function () {
console.log("error");
}
});
您可以在其中包含您自己的数据{parameter_name:value,parameter_name2:value2} 您可以在jquery API中轻松找到的信息
答案 1 :(得分:1)
试试这样:
<script type="text/javascript">
function submitform()
{
document.forms["myform"].submit();
}
</script>
//give your form the id "myform"
<form id="myform" action="submit-form.php">
//and then call the function onCLick
<input type="radio" onClick="javascript: submitform()" ...
答案 2 :(得分:0)
$( "#radiobuttonsondazh_0" ).click(function() {
$( "#kot" ).submit();
});