So, these script don't want to work. Not sure what to do. If i run the page B by itself, everything works fine. If the page A makes an ajax call to page B, none of the scripts within there would work. What do i do? thanks in advance.
the code in page B:
chkBox = function() {
jQuery("#docheckchildren").checkboxTree({
collapsedarrow: "../img/img-arrow-collapsed.gif",
expandedarrow: "../img/img-arrow-expanded.gif",
blankarrow: "../img/img-arrow-blank.gif",
checkchi开发者_运维百科ldren: true,
checkparents: false
});
}
page A ajax call:
$.ajax({
type: "GET",
url:"mypage.cfm",
data:formData,
cache:false,
success: function(res) {
$('#dsp_Grid').html(res);
chkBox();
}
, error: function(xmlHttpRequest, status, err) {
confirm('Error! ' + status +':'+ err);
}
});
page B: if i have to run it by itself, I have to add the following: << the href is different in top pageA: Seems to work since I see the css for the checkboxes.
(Same, src is different in pageA)
I think part of the problem is I am loading whatever returns from pageB to a div in pageA by
$('#dsp_Grid').html(res)
You can either:
- Use a call back function in the AJAX call that calls the scripts that is loaded via AJAX or
- Use the live query feature that will apply whatever functionality on your page to the newly loaded content.
精彩评论