I'm trying to add through ajax/jquery a script into a div seconds after the page has loaded. The script itself is from a CPM network and loads a banner.
When I load it right when the page loads, the script is loaded, but if I add it through ajax, the script stays like this:
<script>content here...<script>
I get the following information after loading it by ajax: "Resource interpreted as Script but transferred with MIME type text/html"
I searched for some solutions but can't find one that works.
Here is the ajax call:
function showAds(){
$.ajax({
url:"pub-horizontal.php",
type:"POST",
async: false,
data: {link:link},
success:function(result){
$("#p1").html(result);
}
});
}
Here is pub-horizontal.php file
<div class="col-xs-12">
<div id="pub-horizontal" class="pub-horizontal">
<?php
$url = $_POST['link'];
if(!strpos($url,"article")){
include("****-horizontal.php");
}else{
include("cpmfun-horizontal.php");
}
?>
</div>
</div>
I tried to output something into the console using the script and it worked! Seems like that the problem is with the script of the CPM network that does not load after the document has loaded...
Thanks in advance.