How to reload google dfp in ajax content? [migrated]
- by cj333
google dfp support ads in ajax content, but if I parse all the code in main page. it always show the same ads even turn page reload the ajax content. I read some article from http://productforums.google.com/forum/#!msg/dfp/7MxNjJk46DQ/4SAhMkh2RU4J. But my code not work. Any work code for suggestion? Thanks.
Main page code:
<script type='text/javascript'>
$(document).ready(function(){
$('#next').live('click',function(){
var num = $(this).html();
$.ajax({
url: "album-slider.php",
dataType: "html",
type: 'POST',
data: 'photo=' + num,
success: function(data){
$("#slider").center();
googletag.cmd.push(function() {
googletag.defineSlot('/1*******/ads-728-90', [728, 90], 'div-gpt-ad-1**********-'+ num).addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
}
});
});
});
</script>
album-slider.php
<!-- ads-728-90 -->
<div id='div-gpt-ad-1**********-<?php echo $_GET['photo']; ?>' style='width:728px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1**********-<?php echo $_GET['photo']; ?>); });
</script>