Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetXmlHttpObject(handler)
- {
- var objXMLHttp=null
- if (window.XMLHttpRequest)
- {
- objXMLHttp=new XMLHttpRequest()
- }
- else if (window.ActiveXObject)
- {
- objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
- }
- return objXMLHttp
- }
- function stateChanged()
- {
- if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
- {
- document.getElementById("city").innerHTML= xmlHttp.responseText;
- }
- else {
- //alert(xmlHttp.status);
- }
- }
- // Will populate data based on input
- function htmlData(url, qStr)
- {
- if (url.length==0)
- {
- document.getElementById("city").innerHTML="";
- return;
- }
- xmlHttp=GetXmlHttpObject()
- if (xmlHttp==null)
- {
- alert ("Browser does not support HTTP Request");
- return;
- }
- url=url+"?"+qStr;
- url=url+"&sid="+Math.random();
- xmlHttp.onreadystatechange=stateChanged;
- xmlHttp.open("GET",url,true) ;
- xmlHttp.send(null);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement