数据库中有很多配置文件,我正在使用PHP获取这些数据。 我想从太多的配置文件中创建一个配置文件默认值。 为了使配置文件默认我正在使用单选按钮。 代码
$("input:radio[name=selection]").click(function() {
if($(this).is(':checked')) {
$(".loader-overley").show(); //show loading image
$.ajax({
url: "addDefault_update.php",
type: "POST",
data: {
col_profile_id: $(this).attr('id'),
},
success: function (data) {
$(".loader-overley").hide(); //hide loading image
alert('Item Updated Successfully !');
window.location.href = 'viewCoProfile';
}
});
}else{ }
});
如果情况正常。
我关注的是 当我在同一个未经检查的事件中检查单选按钮时应该触发
答案 0 :(得分:1)
您只需将代码添加到else
部分。
$(this).is(':checked')
会返回true
或false
。您已为true
编写代码,现在为false
添加适当的代码。