TopHi
TopHi

Reputation: 21

Show ads on ajax pages

I have ajax build website where all the pages are generated inside the main page(s). I was trying to put some ads (not adsense ) For example amazon native , media net or adcash. When I place the code ad does not show on the pages, even after page/site refresh. I can see in the source code, the script is there. Maybe javascript on ajax is the problem... idk... Any solutions?

Upvotes: 1

Views: 798

Answers (1)

norcal johnny
norcal johnny

Reputation: 2115

What I normally do is place the ads code in a separate html file and load it externally.

For instance. create and name a div and load it as such with jquery or javascript

HTML

<div id="thediv"></div>

Jquery

$('#thediv').load("url/ads.html")

Javascript

function load_ads() {
 document.getElementById("#thediv").innerHTML='<object type="text/html" data="url/ads.html" ></object>';
}

Upvotes: 2

Related Questions