/* * Name: * secretword.js * * Description: * Defines functions for making AJAX queries via the HTTP protocol's GET method. * * Pre-conditions: * 'q' : secret word entered by the user * 'secretWordId' : from secret_word.lib * * Post-conditions: * - response from the server for the GET request * * Log: * Kripa Shenai 08/15/2006 * - Creation * */ var xmlHttp function showLink(str1,str2,str3,str4) { if (str1.length==0) { document.getElementById("txtLink").innerHTML=""; return; } xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="/get_secret_word.php"; url=url+"?q="+str1; url=url+"&secretWordId="+str2; url=url+"&liteGraphicId="+str3; url=url+"&stylePrefix="+str4; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtLink").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var objXMLHttp=null if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") } return objXMLHttp }