maxz_pc Posted July 30, 2007 Share Posted July 30, 2007 Hi, I'm trying to generate some javascript with ajax <html> <body> ...... ...... <div id="ajax_here"> <script type="text/javascript"> Calendar.setup( { inputField : "data", // ID of the input field ifFormat : "%Y-%m-%d", // the date format button : "trigger" // ID of the button } ); </script> </div> rest of site </body> </html> the problem is that the code in the div "ajax_here" is not being executed in IE browsers. is there any way to fix this problem? Quote Link to comment Share on other sites More sharing options...
maxz_pc Posted July 30, 2007 Author Share Posted July 30, 2007 this exemple might be easier to understand I'm trying to generate some javascript with ajax test.php <html> <head> <script type="text/javascript" src="ajax.js"></script> </head> <body> <img src="img/cal.gif" onmouseover="open_url('ajax.php', 'test');" /> <div id="test"></div> </body> </html> ajax.php <?php ob_start(); echo "AJAX test<br>"; echo "<img src='http://www.google.ca/intl/en_ca/images/logo.gif' >"; echo "<script type=\"text/javascript\"> alert('script test'); </script>"; header("Content-Type: text/html; charset=ISO-8859-1"); ob_flush(); ?> the problem is that the javascript code in the ajax file is not executed on internet explorer (IE) is there any way to fix this problem? Quote Link to comment Share on other sites More sharing options...
mainewoods Posted August 4, 2007 Share Posted August 4, 2007 you have to run the code returned from ajax through the javascript eval() function. The <script></script> tags have to be stripped off first so only the actual js statements get run throught eval(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.