2

I am looking for a way to have JavaScript dynamically loaded after an ajax call to load a dialog/pop up.

I would like the dialog to load it's own JavaScript files and any in-line JavaScript.

I have seen examples that use a method to do an ajax call to load html into the DOM then have "complete" callbacks that the loading method will call after the html is loaded.

However, using this approach prevents any JavaScript on the dialog from executing and requires that the initiating JS know details about the dialog in order for it to attach events, etc.

Is the only way to accomplish this to have the dialog load the source of the document into an iframe so that it can run the JavaScript?

1 Answer 1

2

It is possible to load external HTML in an iframe and have its JavaScript executed.

See those questions:

Sign up to request clarification or add additional context in comments.

1 Comment

Setting the datatype property of the ajax call to html is exactly what I was looking for!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.