bu şekilde denermisin..
PHP Kodu:
<html>
<head>
<title>Ajax</title>
<script type="text/javascript">
function AJAX() {
var ajax = false;
// Internet Explorer (5.0+)try {ajax = new ActiveXObject("Msxml2.XMLHTTP"); // yeni versiyon xmlhttp
}catch(e){try {ajax = new ActiveXObject("Microsoft.XMLHTTP"); // eski versiyon xmlhttp
} catch (e) {ajax = false;}}
// Mozilla ve Safari
if ( !ajax && typeof XMLHttpRequest != 'undefined' ) {try{ajax = new XMLHttpRequest(); }catch(e) {ajax = false;}}
// Diger
if ( !ajax && window.createRequest ) { try{ajax = window.createRequest();}catch(e) {ajax = false;}}
return ajax;
}
function kontrolet() {
ajax = new AJAX();
var bilgi= document.kformu.epostaadresi.value;
var rumuz= document.kformu.rumuz.value;
var dosya= 'ajaxkontrol.php?epostaadresi='+bilgi+'&rumuz='+rumuz+'';
if ( ajax ) {
ajax.onreadystatechange = function () {};
ajax.abort();
}
ajax.open('GET', dosya, true);
ajax.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
ajax.setRequestHeader("Connection", "close");
ajax.send(null);
ajax.onreadystatechange = function () {
if( ajax.readyState == 4 ) {
document.getElementById('cevap').innerHTML = ajax.responseText;
function AJAX() {};
}
}
}
</script>
</head>
<body>
<form name="kformu" action="javascript:void(0)" method="GET">
E-posta Adresiniz:
<input type="text" name="epostaadresi" onkeyup="kontrolet();"/> <span id="cevap"></span>
</form>
</body>
</html>