codice per istanziare l'XML
codice per controllarecodice:function CreateXmlHttpReq() { var XHR = null; try { xmlhttp = new XMLHttpRequest(); } catch(e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return XHR; }
codice:user = document.forms[1].elements[0].value; ajax = CreateXmlHttpReq(); if(ajax) { ajax.open("GET", "check_name.php?usern="+user+"", true); ajax.send(null); ajax.onreadystatechange = function() {alert("ciao"); if(ajax.readyState != 4) { alert"ciao2"); } else if(ajax.readyState == 4) { alert("ciao3"); } }}
Codice Php
Vorrei semplicemente che funzionassero i 2 alert all'interno di onreadystatechange così poi lo sistemo com serve a me, ma purtroppo non danno segni di vita nessuno dei 3 alert.codice:<? php include "function_mysql.php"; $username = $_GET['usern']; $obj = new MysqlClass(); $obj->connect(); $result = $obj->query("select id from login where username_login = '$username'"); $obj->disconnection(); if(mysql_num_rows($result)==0) {echo("Y");} else{echo("N");} ?>

Rispondi quotando
