Sorry, stupid question, I already solved this on my own. Using the onsubmit event in the form tag helps a lot ;-)
Harald > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Harald Dietrich > Sent: Dienstag, 16. Januar 2007 17:59 > To: jQuery Discussion. > Subject: [jQuery] Problem loading HTML and Script Code with Ajax > > > Hello, > > I've got the following problem: My page is loading > dynamically an HTML formular using the $.post() function. I > would like to submit this formular using the $ajaxForm() > function from the forms library. The HTML fragment I am > loading looks like this: > > <form id="myForm" method="post" action="upload"> > <input type="hidden" name="abc" value="xyz" /> > <input type="submit" name="submitButton" value="Submit" /> > </form> > > <script type="text/javascript"> > //<![CDATA[ > $('#myForm').submit(function() { > var options = { > target: '#myForm', > }; > $(this).ajaxSubmit(options); > return false; > }); > //]]> > </script> > > When I am loading the fragment, the javascript will not be > executed and the form will not be prepared for the ajax > request. Submitting the formular will end up in a plain HTTP request. > > Can anyone tell me how to solve this? > > Thanks, > Harald > > _______________________________________________ > jQuery mailing list > [email protected] > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
