First, as far as i can see, the variable "alldone" will always be false when
loadMe() is called, coz, i guess the variable is scoped within that
function.

Otherwise, what you are doing is correct. You are binding the click event to
the "span" tag that just got returned from the server, which is the right
way to do this...

It works in firefox without this binding because, the span that gets
returned from the server is within a "p" tag. This "p" tag gets the event in
the event bubbling phase. Since, there is no such phase in IE, the event is
not captured.

Ganesh.



On 6/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


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




--
-GTG

Reply via email to