// Wait until dom is ready... $( document ).ready(function() { updateOffer = function(){ // syntax is /invoke/// // where target is one of : dev | test | prod // clientname is default "client" // rulename is what is specified in the ui when publishing the rule var offercheck = $.post(ddeLoc + "getoffer", '{"sessionid":"' + getSessionId() + '"}') .done( function(dataReturned){ $( ".showoffercode" ).text( dataReturned.offercode ); $(".banneroffer").hide(); var offertoshow = $("#"+dataReturned.offercode); if (offertoshow.length == 0){ $("#DEFAULT_OFFER").show(); } offertoshow.show(); // console.log(offertoshow); }) .error(function(XMLHttpRequest, textStatus, errorThrown){ if (console.log){ console.log("DRE call failed: " + textStatus + " / " + errorThrown) } }) } // Make an initial call to SDL RERE updateOffer(); // And re-check what the banner should be every 5 seconds - so we can respond to actions // that happen in another system such as the IVR. // setInterval(updateOffer, 3000) });