Jump to content

making 2 functions into 1


squiblo

Recommended Posts

Please could somebody make these two functions into one function

 

function showUser1(str)
{
xmlhttp1input=GetXmlHttpObject1();
if (xmlhttp1input==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url1="http://localhost/includes/chat/chat_output/sql_output/sql1.php";
url1=url1+"?q="+str;
url1=url1+"&sid="+Math.random();
xmlhttp1input.onreadystatechange=stateChanged1;
xmlhttp1input.open("GET",url1,true);
xmlhttp1input.send(null);
}

function stateChanged1()
{
if (xmlhttp1input.readyState==4)
{
if (document.getElementById("chatoneoutput").innerHTML != xmlhttp1input.responseText){
  document.getElementById("chatoneoutput").innerHTML = xmlhttp1input.responseText;
}


}
}

Link to comment
https://forums.phpfreaks.com/topic/200048-making-2-functions-into-1/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.