Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adsence disappear with Ajax

2 views
Skip to first unread message

EnjoyNews

unread,
Jul 17, 2008, 6:56:56 PM7/17/08
to
Hi

I have a little problem with java ajax...

On my site I have a google adsence placed in a list. After the first 10
records it shows a adsence commecial.

But.. on my search page I use Ajax to get the search result while you type
the searchword.
This works fine and a list is shown that matched the searchword.
The page that ajax calls contains a list which is exactly the same as the
normal list on my site. So there are also a google adsence placed in the
search list.
But, the adsence isn't shown.

I have tried testing it a litlle more, and it seems that an adsence placed
somewhere in the page that ajax calls doesn't show on the screen. In the
source hte adsence is just gone.

So my question is, why do the adsence script disappear when the page is
calls with an ajax script.
If I type the direct url to the page called by ajax the google adsence is
shown. So it's only the ajax calls the page it doesn't work ?


Does anyone have a solution for this problem ?


best
Michael


Bart Van der Donck

unread,
Jul 18, 2008, 5:34:44 AM7/18/08
to
EnjoyNews wrote:

Hard without looking at the code, but my first thought goes to a
conflict in variables, DOM, namespace or the like.

--
Bart

EnjoyNews

unread,
Jul 18, 2008, 8:28:59 AM7/18/08
to

"Bart Van der Donck" <ba...@nijlen.com> skrev i en meddelelse
news:0557b9de-ac25-4817...@f40g2000pri.googlegroups.com...

Hi again

I have tried copying the codes necesary here.
Maybe it would help with an explanation.


My search site sends the data like this:
<form method="post" action='<?=$_SERVER[PHP_SELF]?>' class="form" id="form"
name="form">
<div>Searchword: <input type="text" id="searchfield" name="searchfield"
onkeyup="Search(this.value, 'showdiv', 'Please wait');"></div>
</form>
<div id="showdiv"></div>


My java looks like this:
function Search(Searchword, siteElement, callMessage) {
document.getElementById(siteElement).innerHTML = callMessage;
try {
req = new XMLHttpRequest(); /* f.eks. Firefox */
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP"); /* IE-versioner */
} catch (e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP"); /* IE-versioner */
} catch (e) {
req = false;
}
}
}
req.onreadystatechange = function() {AnswerSearch(siteElement);};
req.open("GET","SearchResult.php" + "?Searchword=" + Searchword,true);
req.send(null);
}

function AnswerSearch(siteElement) {
var output = '';
if(req.readyState == 4) {
if(req.status == 200) {
output = req.responseText;
document.getElementById(siteElement).innerHTML = output;
}
}
}

And finally the SearchResult page is just:
<?header('Content-Type: text/html; charset=iso-8859-1');
$searchword=$_GET['Searchword'];
..
..
<script type="text/javascript"><!--
google_ad_client = "pub-6871844744136964";
google_ad_slot = "...hidden...";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
..
..


EnjoyNews

unread,
Jul 23, 2008, 7:30:43 PM7/23/08
to

"EnjoyNews" <mh-ny...@mail.dk> skrev i en meddelelse
news:48808c93$0$56784$edfa...@dtext02.news.tele.dk...


Anyone on this one ?


0 new messages