tags:

views:

144

answers:

1

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",
   checkchildren: 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)

A: 

You can either:

  1. Use a call back function in the AJAX call that calls the scripts that is loaded via AJAX or
  2. Use the live query feature that will apply whatever functionality on your page to the newly loaded content.
Vincent Ramdhanie