Adsence disappear with Ajax

E

EnjoyNews

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
 
B

Bart Van der Donck

EnjoyNews said:
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 ?

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

EnjoyNews

Bart Van der Donck said:
Hard without looking at the code, but my first thought goes to a
conflict in variables, DOM, namespace or the like.

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>
...
...
 
E

EnjoyNews

EnjoyNews said:
Bart Van der Donck said:
Hard without looking at the code, but my first thought goes to a
conflict in variables, DOM, namespace or the like.

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>
..
..


Anyone on this one ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,142
Messages
2,570,818
Members
47,362
Latest member
eitamoro

Latest Threads

Top