Results 1 to 3 of 3
Sep 28, 2007, 11:57 #1
- Join Date
- Oct 2003
- Richland MS
- 0 Post(s)
- 0 Thread(s)
Adding ajax functionality to content loaded via ajax
I am currently working a site which will use ajax. I have a menu that, when the items are clicked, uses jQuery load() to load a page. It works fine. The problem I am having is that the pages I am loading also have links or forms which need to use ajax. However, since the main page is already loaded when the pages are loaded via ajax, I don't have a chance to assign listeners to the new links or forms. Does that make sense?
Here is an example. I have a link that says "clients". This link has a click event added via the jquery.ready() function. I can click the link, and the new page will be loaded by ajax. Now, this client page contains a list of links which point to various client functions. I have used a callback function to add the click event to these links. Now, lets say that I click on the "add client" link. This page loads and contains a form. How do I add ajax to this form? I have tried putting a line in the callback function to do it, but it doesn't seem to be called when the page with the form is loaded. It seems to only be called when I click one of the links on the client page.
I think that if I nest another call back function in the alread nested one, It will work. but that seems like a such a hassle. If this isn't clear I can try to clear it up. Just ask.