jQuery code doesn't work on dynamic content loaded with ajax
So here's my first post on this forum, let's see how this works! I really hope anyone out here can help me with this struggle I'm in. Let me try to explain it:
I have an index.php with thumbnails of a few projects, followed by the full content of one of those projects.There's some jQuery in the index that I use on the content in this page. Everything works fine when the project content is hard-coded into the index, but I want it to load dynamically through an AJAX call. I got that working too, it loads the content from the database without reloading the page, but then I run into my problem: none of the jQuery works on the 'new' content.
I use two separate files to get the content: xmlhttp.js with a function that is fired when you click on one of the thumbnails on the index. This uses a separate .php file with a mysql request to get the right content, and then injects this response into the right element on the index.
Does anyone have an idea where I go wrong? Thanks a lot for your time in advance.