Problem in learning AJAX with PHP
-
hi ... i m trying to make this me first simple AJAX example using PHP that shows message from PHP on clicking Button in HTML page .... but this case some prolem ... that is when click on button to show message then nothing is happen .... is also check WAMP ... so any idea or suggestion !!!! HTML CODE IS,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MyFirstAJAXProram</title></head>
<body>
<script type="text/javascript">function JavaFunction() {
var xmlhttp;
<!--Getting XMLHttpRequest OR Active depends on browser support...-->
if(window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate == 4) { document.timerForm.time.value = xmlhttp.responseText; } } xmlhttp.open("GET", "phpfile.php", true); xmlhttp.send(null);
}
</script>
<form name="timerForm">
<input type="button" onclick="JavaFunction()"; />
Time: <input type="text" id="timer" name="time" value="00:00:00" readonly="readonly" />
</form>
</body>
</html>HERE's PHP CODE,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head><body>
<?
echo("KHURRAM SHAHZAD");
?>
</body>
</html> -
hi ... i m trying to make this me first simple AJAX example using PHP that shows message from PHP on clicking Button in HTML page .... but this case some prolem ... that is when click on button to show message then nothing is happen .... is also check WAMP ... so any idea or suggestion !!!! HTML CODE IS,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MyFirstAJAXProram</title></head>
<body>
<script type="text/javascript">function JavaFunction() {
var xmlhttp;
<!--Getting XMLHttpRequest OR Active depends on browser support...-->
if(window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate == 4) { document.timerForm.time.value = xmlhttp.responseText; } } xmlhttp.open("GET", "phpfile.php", true); xmlhttp.send(null);
}
</script>
<form name="timerForm">
<input type="button" onclick="JavaFunction()"; />
Time: <input type="text" id="timer" name="time" value="00:00:00" readonly="readonly" />
</form>
</body>
</html>HERE's PHP CODE,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head><body>
<?
echo("KHURRAM SHAHZAD");
?>
</body>
</html> -
khurram_shahzad wrote:
so any idea or suggestion
Since this is the Java forum I suggest you post this elsewhere - possibly either JavaScript or PHP.
Just say 'NO' to evaluated arguments for diadic functions! Ash
Oh i c ...... :-)