$(function(){
$('.update-mod-form').bind('ajax:success', function(evt, data, status, xhr){
data = $.parseJSON(data);
console.log(data.success);
console.log(data);
if (data.success == true) {
$('#page').html(data.html);
}
else {
}
});
});
Do you see any JS bindings Best practices that could correct a bindings problem? This method works, once then After the data.html is added with the .html method, the method doesn’t work a second time.
The data.html, generates a class .update-mod-form, which is unbound How can I bind this new class?
I should also note that I have multiple occurrences of this class, is it possible to bind more than one element of a class to a method in this way?
If
#update-mod-form isis inside#page, then after first ajax call, this form (and its bindings) is wiped out. You have to rebind it, or uselivenotbind.ps. you sure the event is
ajax:successnotajaxSucces? And why are you using global event at all?