function getHttpRequest() { var request = false; try { //try the create the XMLHttpRequest object request = new XMLHttpRequest(); } catch (trymicrosoft) { try { //try to create the XMLHttpRequest using ActiveXObject via Msxml2.XMLHTTP request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { //try to create the XMLHttpRequest using the ActiveXObject via Microsoft.XMLHTTP request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { //There is no way to create the object. request = false; } } } if(!request) alert("Cannot create XMLHttpRequest()"); else //alert("yapers"); return request; } //The form variable can act as an HTML form or eventIDs //function callServer(form,functionCall) function callserver(view_name,groupID,themeID,page_number,search_input,total_records) { //alert(functionCall); //var errorMsg = validateForm(form,functionCall); //if(errorMsg != "") //{ //document.getElementById('ErrorMessage').innerHTML = "Please fix the following error(s):
"+errorMsg; //return; //} //alert("in callServer"); //url=""; //error = ""; request = getHttpRequest(); //alert(request); if (!request) { alert("unable to get XMLHttprequest"); return false; } //var path = "http://192.168.51.228/wp-mu/wp-content/themes/wznews/"; //var url = path+"View/controller.php?" + var url = "/wp-mu/wp-content/themes/wznews/View/controller.php?" + "view=" + view_name + "&group=" + groupID + "&PageNo=" + page_number + "&Theme=" + themeID + "&Search=" + search_input + "&rec=" + total_records + "&alg=asc"; //add a random number to prevent the server from using a cached file url=url+"&sid="+Math.random(); //alert(url); //exit(); request.open("GET",url,true); //when the server is done processing. This page will execute the function() request.onreadystatechange = function() { /*** //check the status of the request try { alert(request.status); } catch (error) { alert(error); } ***/ if(request.readyState == 4 || request.readyState=="complete") { if(request.status == 200) { document.getElementById('output').innerHTML = request.responseText; } else if (request.status == 404) { document.getElementById('output').innerHTML = "Request URL not found "; } else { //alert("not good to go"); document.getElementById('output').innerHTML = "Unable to get a response back from the server"; //document.getElementById('ErrorMessage').innerHTML = request.status; } } } request.send(null); }