Im not sure whats up with the listener but the function is not working and i cant seem to find out whats wrong.
my other function works fine but when i paste this into the functions area (i dont even call it yet) then the other functions stop,
so it seems that maybe there is something broke here.
Code:
var xmlHttp
function tog_email(nemail,neid)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="email_availability.php";
url=url+"?nemail="+nemail"&neid="+neid;
xmlHttp.onreadystatechange=Changed;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}//close function toggle email
function Changed()
{
if (xmlHttp.readyState==4)
{
settextflag();
}
}//close function changed
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}//end function GetXmlHttpObject
and then the settextflag function is here (this is just for testing to make sure im finishing the process)
Code:
function settextflag(){
document.getElementById('emailswitch').value="p";
}
and then here are my inputs
Code:
<input type="text" id="hiddenemail" name="hiddenemail" value="<?php print("$email"); ?>" onchange="tog_email(this.value,$advuser);" />
<input type="text" id="emailswitch" name="emailswitch" />
a couple of points, the test for email_availablilty works fine, i tested it with direct url and with url vars and that file works fine.
im not an ajax person so i dont understand why im not getting the silent process being executed. When i remove the tog_email function and the rest of the on change httprequest stuff and call the settextflag() direct, then it works, when i change the field value for hiddenemail then the other input changes to a "p" but then when i add the tog_email and other httprequest stuff back (and not even call it) nothing works.