views:

367

answers:

3

I use a plug-in called nyroModal to call a page via AJAX and display it in a modal window. When the AJAX gets the page, it creates a div on the current page, when nyroModal then styles and creates the modal page for you. Problem is, it seems to strip off all the tags out of the requested page. Using firebug I can see the tags in the return of the AJAX request, but they don't show up on the page. Is this just a limitation of not being able to add tags to the DOM after loading the page, or is this a problem with the nyroModal plug in I'm using?

Thanks!

+1  A: 

jQuery will not include the scripts directly in the dom but it creates a new script tag(s) in the header of the document for you. If you click the scripts menu in firebug you should see the global eval'd script in the dropdown.

redsquare
Thanks, that saved me a lot of trouble!
Constant M
A: 

I recently saw this script. shipment because you can be a solution to your problem. Do not probe into a case like yours

andres descalzo
A: 

The problem was that I needed to put my script in after the DOM element it was pointing to, else when the script was run, the DOM element it was pointing to didn't "exist" yet. Normally, $(document).ready solves this problem, but since the document was already 'ready', it executed the script before the element existed.

EXAMPLE:

This will not work.

<script type="text/javascript>
$('#test').val('Yes');
</script>

<input type="text" value="" id="test">

This will.

<input type="text" value="" id="test">

<script type="text/javascript>
$('#test').val('Yes');
</script>

Hope this helps somebody.

Constant M