I have this script...
$.post('../script/php/getnumtreated', {
medicalid: $('#medicalid').html(),
numaffected: $('#numaffected').html()
}, function(data) {
if (data == 1) {
//Show #resolve radio button
}
else if (data == 0) {
//Hide #resolve radio button
}
});
The radio button group is initially shown, it has 2 radio buttons 'resolve' and 'n开发者_运维知识库ot resolve'.
From my script the "data" must be equal to 1 before #resolve radio button has to show and 0 for the radio button to hide, but the radio button group only appears after a button is click.
'#add' button must be click first to create the radio button. The radio buttons comes from a separate PHP script.
How do I access those radio buttons even if #add has not yet been click?
I'm trying to do something similar to live()
isShowResolve = true;;
$.post('../script/php/getnumtreated', {
medicalid: $('#medicalid').html(),
numaffected: $('#numaffected').html()
}, function(data) {
if (data == 1) {
isShowResolve = false;
showHideResolve()
}
else if (data == 0) {
isShowResolve = true;
showHideResolve();
}
});
$("body").ajaxSuccess(function(){showHideResolve();});
function showHideResolve(){
if($("#resolve").size()>0){
if(isShowResolve)$("#resolve").show(); else $("#resolve").hide();
}
}
did you try $('#resolve').live('....',function()...
??
精彩评论