NokFrt Posted September 24, 2013 Share Posted September 24, 2013 I want to show Leadboalt ads in my game. According to Leadbolt: Ads are served only when the javascript code is loaded, the ad will not be refreshed until the javascript code is loaded again. I wrote the following code to load the ads, but it doesn't work - I don't see any ads, it looks like I can't load javascript dynamically. Can you please someone tell me what could be wrong with my code? If I put the leadbolt script directly into the ads_container (div) in index.html then a banner is displayed, but I don't know how to refresh it. function showAdsBanner(aPos, aSrc, aRefreshRate) { var adsContainer = document.getElementById("ads_container"); adsContainer.style.top = aPos + "px"; adsContainer.style.display = "block"; var script = document.getElementById("ads_banner"); if (script) document.removeChild(script); script = document.createElement("script"); script.id = "ads_banner"; script.type = "text/javascript"; script.src = "http://ad.leadboltmobile.net/show_app_ad.js?section_id=485846630"; adsContainer.appendChild(script); ... } Quote Link to comment Share on other sites More sharing options...
Quetzacotl Posted September 24, 2013 Share Posted September 24, 2013 Check if script onLoad callback is called. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.