duplicate javascript actions on jQuery ajax get script -
hello problem after ajax response want reload script. in response there te same buttons in original content. managed load script again 1 more ajax request script, functions script duplicated. ex.
$('button#go').bind('click',function(){ $.ajax({ url: "go.php", cache: false, context: document.body, type: "post", data: { data:'test'}, beforesend: function() { $('button').attr('disabled',true);$('#loading').show(0); } }) .done(function( html ) { $('button').attr('disabled',false); $('#loading').hide(0); $( "#ajaxreply" ).html( html ); $.ajax({ type: "get", url: "script.js", datatype: "script" }); }); });
how can prevent duplicating functions, or refresh script after ajax response ?
Comments
Post a Comment