Hi,

I have a form with a couple of ajaxified inputs (they have dynamically
generated <script> tags next to the <input> tags). This all worked
quite well, until I decided to load that form via AJAX into a jQuery
dialog on another page. The form is correctly fetched and inserted
into the DOM, but the <script> tags are nowhere to be seen and the
javascript code doesn't get executed. The code looks something like
this:

$("#form_dialog").dialog({ /*some options */})
   .load("/url/to/form_page/ #form_container", show_dialog);

I found a bug report [1] that describes the problem and was closed as
invalid. Tough luck. But not being one of those that give up easily, I
slightly modified my code:

$("#form_dialog").dialog({ /*some options */})
   .load("/url/to/form_page/", show_dialog);

And presto, it executed the javascript embedded in the newly loaded
content! Of course, it loaded all kind of content into the dialog that
I didn't want there, but that can be fixed serverside.

Now I'm wondering of course: why does such a little modification
(filtering after body instead of div#form_container) change the
behaviour in such a (for me) unexpected way? Is one of those
behaviours a bug? If yes, which one? If it isn't a bug, I think it at
least warrants some documentation.

Kind regards,
Benjamin

[1] http://dev.jquery.com/ticket/3428

Reply via email to