Alith7
07-21-2009, 04:51 PM
I have two functions right now that work great separately. I would like to combine them, but i'm not sure how. here is what I have:
function selCustContact(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="/scripts/updatecust.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=custContactChange;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function custContactChange()
{
if (xmlhttp.readyState==4)
{
document.getElementById("custContact").innerHTML=xmlhttp.responseText;
}
}
function selSalesRep(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="/scripts/updaterep.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=custRepChange;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function custRepChange()
{
if (xmlhttp.readyState==4)
{
document.getElementById("salesRep").innerHTML=xmlhttp.responseText;
}
}
I would like to run them both when I change a drop down menu, how do I do that? i'm sorry, I'm REALLY new to all this and trying to figure out some complex stuff as I go.
Thank you for your help in advance!
function selCustContact(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="/scripts/updatecust.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=custContactChange;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function custContactChange()
{
if (xmlhttp.readyState==4)
{
document.getElementById("custContact").innerHTML=xmlhttp.responseText;
}
}
function selSalesRep(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="/scripts/updaterep.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=custRepChange;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function custRepChange()
{
if (xmlhttp.readyState==4)
{
document.getElementById("salesRep").innerHTML=xmlhttp.responseText;
}
}
I would like to run them both when I change a drop down menu, how do I do that? i'm sorry, I'm REALLY new to all this and trying to figure out some complex stuff as I go.
Thank you for your help in advance!