Hi everybody :)
I have a very stupid answer but I cannot solve it!
Connect to the mysql db, I get the records that are URLs, into the php loop I call an ajax function that reads the title tag address of the URL
ajax code
function getTitle(str1,str2)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("titleTag_"+str2+"").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","url_title.php?url_name="+str1+"",true);
xmlhttp.send();
}
php code
<?php
while ($fields = @mysql_fetch_array($Query)) {
// call function that reads the title tag for each URL Listed
?>
<script type="text/JavaScript">
<!--
new getTitle('<?php echo $fields['url']; ?>', '<?php echo $fields['idOfUrl']; ?>');
-->
</script>
<div id="tagTitle_<?php echo $fields['idOfUrl']; ?>">HERE OUTPUT</div>
<?php
}
?>
but this "dirty" method does not work 'cause I think the function does not have time to read!
however..
if I change page and go back in browser window titles are shown correctly, then the function is written correctly
how can I solve it?