/***************************************************************************** * * AJAX style http request. * * Author: Jarrod B. Reuter * Email: Jarrod.Reuter@gmail.com or Jarrod@foobarfusion.com * * Description: This allows us to call a server side page and return it's * results without refreshing the page. * * Details: This uses GET to send via URL. * * Created: 4/2006 * *****************************************************************************/ function evalRequest(url) { req = false; // branch for native XMLHttpRequest object if (window.XMLHttpRequest){ try { req = new XMLHttpRequest(); } catch (e) { req = false; } }else if (window.ActiveXObject){ try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject ("Microsoft.XMLHTTP"); } catch(e) { req = false; } } } if (req){ req.onreadystatechange = function() { if (req.readyState==4 && req.status==200) { eval(req.responseText); } } req.open("GET", url, true); req.send(null); } } /***************************************************************************** * * AJAX style http request. * * Author: Jarrod B. Reuter * Email: Jarrod.Reuter@gmail.com or Jarrod@foobarfusion.com * * Description: This allows us to call a server side page and return it's * results without refreshing the page. * * Details: This uses POST to send via URL. * * Created: 4/2006 * *****************************************************************************/ function evalRequestPOST(url,str1,str2,str3) { req = false; // branch for native XMLHttpRequest object if (window.XMLHttpRequest){ try { req = new XMLHttpRequest(); } catch (e) { req = false; } }else if (window.ActiveXObject){ try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject ("Microsoft.XMLHTTP"); } catch(e) { req = false; } } } if (req){ req.onreadystatechange = function() { if (req.readyState==4 && req.status==200) { eval(req.responseText); } } var str = ""; str += "search=" + str1 + "&searchq=" + str2 + "&tables=" + str3; req.open("POST", url, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); req.send(str); } } /***************************************************************************** * * Function: usernameCheck * * Author: Jarrod B. Reuter * Email: Jarrod.Reuter@gmail.com or Jarrod@foobarfusion.com * * Description: Uses evalRequest() to check a php file. The file should * query the db and print a call to another javascript func * * Created: 4/2006 * *****************************************************************************/ function usernameCheck(){ var uname = document.getElementById("registration").uname.value; var url = "/user_check.php?name=" + uname; evalRequest(url); } /***************************************************************************** * * Function: usernameResult * * Author: Jarrod B. Reuter * Email: Jarrod.Reuter@gmail.com or Jarrod@foobarfusion.com * * Description: Called from a php file with true/false variable. This * outputs error is username is taken, or simply states it * is available to the user. * * Created: 4/2006 * *****************************************************************************/ function usernameResult(val){ scroll(0,0); if(val) document.getElementById("output").innerHTML = "