Skip to content Skip to sidebar Skip to footer

Jquery And Ajax Post Issue

I am trying to add a click event on the element that is return from the server via ajax. Apparently, I have to attached my js file inside my return response instead of my main scri

Solution 1:

Try jquery live events. These events allow you to attach events to the dom as new elements are added. For instance I run my page and this page calls an ajax get/post that inserts a div with id "mydiv" to the dom. My live event will hook to the newly added div. This way you can keep all the necessary javascript for a single page in one library. Check it out it is very useful.

Solution 2:

You must call your js file in page include input <input type='button' id='add' value='add'/>

If not the code $("#add").click(function(){ will not find element called #add

Post a Comment for "Jquery And Ajax Post Issue"