I'm not understanding what you're trying to do. You just want your AJAX to return Javascript code and have it executed?
If so, you can use the eval() function, but be careful of the source of your Javascript. On Feb 16, 10:30 pm, "s.flemin...@googlemail.com" <s.flemin...@googlemail.com> wrote: > I am trying to write my first application, and am trying to use jquery > to help me along my travels. > > I have setup my application to work so all pages are loaded via ajax, > using anchor's as navigation. However on some pages that i return > using the AJAX i want to be able to run code. > > This works on firefox, however it does not work on anything else. So > really my question is: > > How do i run javascript code from an ajax response? > > <p> > <form action="ajax/forms.php" method="post" id="myform"> > Title: <input type="text" name="title" /> > <input type="submit" value="Submit" name="submit" /> > </form> > </p> > <script type="text/javascript"> > // attach handler to form's submit event > alert("Javascript"); > $('#myform').submit(function() { > // submit the form > alert("form submitted"); > // return false to prevent normal browser submit and page > navigation > return false; > > }); > > </script> > > In the above, i only get an alert saying "Javascript" in firefox. Any > other browser and it does not work. > > Please help!