I have a button with the class ‘check_button’ in the div ‘check_div’. I have a Jquery code that if the user clicks on the button, the script send an Ajax request to the server. After that he reloads the div with .load(), so he also reloads the button. The problem is that then the Jquery code doesn’t work for the button. I read other Stackoverflow articles but I am new in Ajax and Jquery so I don’t know how to solve my problem. Link I found with the same problem (I think): Manipulating elements after AJAX load()
Share
If I understand you correctly you do 2 calls to the server:
Why not do that in 1 call?
In you response from the server you can json encode whaever you want to send back to the client.
As for you question:
Also all dynamically added elements can be used with:
Or even better with
.delegate():$(container).delegate(‘.check_div’, ‘click’, function() {
});
in stead of:
For more info check out:
http://api.jquery.com/jQuery.ajax/
http://api.jquery.com/delegate/
http://api.jquery.com/live/