I need to apply AJAX loader that loads some different contents form the page, to a existing CMS.
The problem is that some of those contents, contain included JS Files or inHTML JS.
$.ajax({
type: "GET",
url: refURL,
success: function(resultData){
//returns the content in $content
showContents($(resultData), title);
},
error: function(){
showContents("something went wrong", "ERROR 404");
}
});
showContents() uses .HTML() to place the content into $(resultData) after some fancy animation. This works fine as long as there is no JS in the requested pages..
Is there any way i could make this work?
Perhaps you should use directly the
innerHTMLproperty of the element you are using.and pass it to the
showContentsmethod in raw formatshowContents(resultData, title);(if the resultData is what you want to insert in the DOM)