You are here: ajax & php & javascript « All PHP « IT news, forums, messages
ajax & php & javascript

Posted by Ivan P on 09/28/00 11:48

Hello!

I have a index.php that on one click calls via AJAX a file.php.

index.php looks like this:

<html >
<head>

<script language="javascript" type="text/javascript" >


var http; // We create the HTTP Object
var dest;
var prenosi;
function getHTTPObject() {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}

function processStateChange(){
if (http.readyState == 4){
contentDiv = document.getElementById(dest);
if ((http.status == 200)||(http.status==0)){
response = http.responseText;
contentDiv.innerHTML = response;
} else {
contentDiv.innerHTML = "Error: Status "+http.status;
}
}
}



function loadHTML(URL, destination){
dest = destination;
var url;
http = getHTTPObject();
if(http){
http.onreadystatechange = processStateChange;
http.open("GET", URL, true);
http.send(null);
}
}

</head>
<body>

<span onclick="loadHTML(file.php','')">Click</span><br>
</html>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -

file.php looks like this:

<span id="countdowncontainer">
write something down
<script type="text/javascript">
document.write("1")
</script>
</span>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -

The problem is that "write something down" displays on the Internet
Explorer, but number 1 doesn't. If we call just file.php - it works then -
it displays both. Why is javascript not executing from ajax called
procedure?

Ivan Petrovic

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация