Welcome to the unobtrusive philosophy : http://simonwillison.net/static/2008/xtech/
This is somewhat big to take in one big gulp but I promise you will greatly benefit from reading this right now before you try to use jQuery and AJAX in a messier way and find it hard and not rewarding. Kind regards. Michel Belleville 2009/11/23 Rockinelle <ericbles...@gmail.com> > I am jumping into ajax with Jquery and I have what I think is an easy > question. I have successfully used jquery load to bring an external > php doc into my page. That page has a form on it where I want to use > jquery to reload that external page to reload with ajax when the form > is submitted. What I need to know is where to put the code to act on > the external form. Do I place the code on the page .load ing the > external form or do I need to place it on the external form? > > I've tried it both ways and I can't get it to work. > For testing I'm just doing something simple > $(document).ready(function(){ > $('#submit1').click(function(){ > alert('It works!'); > }); > }); > This code does work when it's located on the external form and I load > that form explicitly rather than through an ajax call. What am I > missing? > > I guess my question has a greater scope than just this example. Will > javascript on a main page act on selectors that match those in a div > that's loaded through ajax? The same question with CSS too. >