Having issues running scripts via the elements created from an ajax
call with Internet Explorer, and found one way around it, by firing
off a little function on the call back. as below: loadMe()

In this way the second function can be used with no issue in IE and
Opera, FF never had a problem in the first place.

My question about this though, is there some function in jQuery that I
am missing that already covers this issue, or is there a better/
cleaner way of doing this?

Basic demo at: http://yournrl.com/

$(document).ready(function() {
  $("p").click( function() {
      $.post("import.php", function(data){
        $("div#dataHere").html(data);
        loadMe(); // on success response from post call without this IE and
Opera cant access the span click function
      });
  });
});

function loadMe(){
 if(alldone!==true){ // check that this function is not already
running
  $("span").click( function() {
      $.post("something-else.php", function(data){
        $("div#dataHere").html(data);
      });
   });
 var alldone = true;
 }
}

Cheers

Stephen

Reply via email to