On Dec 27, 10:07 am, merchz <merch...@hotmail.com> wrote: > When I click that Cancel button, the alert executes just like I want it to > do. But I can't figure out why?? I mean how can the eventhandler register > correctly. Is the Cancel button from the AJAX call somehow magically insert > into the DOM before the script registering the event executes?
Hey, a magician never reveals her tricks, right? :-) In fact, though, that's exactly what happens. The script tags are stripped out of the response and inserted and run after the rest of the DOM changes. This could be a problem if you're trying to use script tags for something other than JS content, but that's pretty rare. Cheers, -- Scott