I'm trying to get all the radio buttons with their names and check if they are blank. If one is blank, then the form will show an alert and will not submit. If all buttons are filled, then it will go to the "else" part and see whether the answer is correct. If it is correct, then it will show the right values in that page <div>
. I have to go through the reference of
How to check a radio button with jQuery ?, but it seems it can't help me at all.
Here's my code:
uc_apply_flag keep returning 0
var uc_apply_flag = $(" [name=\"uc_apply_flag\"]:checked ").val() ;
if( uc_apply_flag || ( !uc_apply_flag && uc_apply_flag != 0 ) )
{
_alert("请选择是否代理功能");
return;
}
$.ajax({
url: "/userCenter/updSpread.html",
type: 'POST',
dataType: 'json',
data: {
uc_apply_flag:uc_apply_flag,
s_affect_amount_3dt:amount_3dt,
s_affect_amount_ssc:amount_ssc
},
success: function(data) {
if (data.hasOwnProperty('msg') && data.msg != '' && data.status != 1) {
_alert(data.msg);
} else {
_alert('修改成功!');
}
},
error:function(data){
$.hide_loading();
}
});
});
//复制按钮
$("#btn_copy").zclip({
path:'<?php echo RESOURCE_SITE_URL?>/swf/ZeroClipboard.swf',
copy:function(){
return $('[name="spr-site"]').val();
},afterCopy: function () {
_alert("复制成功");
}
});
});