I'm using ajax to get the content (html, css, javascript) from another file. Everything works perfected initially; however, if I run this ajax request a second time, all the javascript from the first call remains saved on the dom, so any .on("click")
functions get executed twice. I've tried $("#contentHolder").empty()
with no success. Also, I do need to execute the ajax call more than once (I can't call it once, save the content, then just .hide/.show
as needed).
$.ajax({ type: "GET", url: "page.php", dataType: "html", success: function(data){ $("#contentHolder").html(data); }});