Bind jQuery method to Html loaded through an Ajax call -
i have content loaded ajax call want bind custom method (not event) dom elements achieve functionality.
most of solutions find online binding events page
$(".example").ajax({ 'success': function(data) { something() } })
i want achieve 'on load of content' because there no event there..
$('.post').live('load', function() { ..... });
consider .ajaxcomplete
.
http://api.jquery.com/ajaxcomplete/
for example:
// have anonymous function. make named function. function myinitialize(scope) { $('.button', scope).button(); } // call in document ready initialize stuff loaded in page. $(myinitialize(null)); // call again in .ajaxcomplete // 'this' div loaded or has new content. $('*').ajaxcomplete(myinitialize(this));
Comments
Post a Comment