![](https://secure.gravatar.com/avatar/38f2392ef254823cbd6cb5e6305289d6?rating=PG&size=50&default=https%3A%2F%2Fcdn.desk.com%2Fassets%2Funknown_user_50-8ad5644bbe6b1bd7454f2ea465f782bd.png)
scheduling ads via javascript
Hi Team,
I'm adding ad tags via javascript but this below scripting doesn't work, please can you look at it.
var adSchedule="{";
function pushAd(adTime,adTag){
ctrl=true;
if(adTime=="pre" || adTime=="post"){
adStr='roll'+adRollCount+':{offset:"'+adTime+'",tag:"'+adTag+'"},';
}else{
adStr='roll'+adRollCount+':{offset:'+adTime+',tag:"'+adTag+'"},';
}
adSchedule = adSchedule.concat(adStr);
adRollCount++;
}
function commitAds(){
adSchedule = adSchedule.concat("}");
adSchedule = adSchedule.replace("},}", "}}");
}
//Below I'm passing generated 'adSchedule' string to the schedule tag
advertising: {
client: adtype,
'skipoffset':5,
schedule: adSchedule
},