var http = getXHTTP(); // This executes when the page first loads.

function doHttpRequest() {  // This function does the AJAX request
 
  
  if (arguments[0]) {
          var str = arguments[0];
	  //if (typeof arguments[0] == 'number')  str = "&PageNo=" + arguments[0];
	  //if (typeof arguments[0] == 'string') 	str = "&Brand=" + arguments[0];
	  	//alert (str);
  }
  
  //  Set our destination PHP page "ajaxpost.php"…
  http.open("POST", "/wp-content/themes/AkselTheme/ReadData2.php", true);
  http.onreadystatechange = getHttpRes;
  
  // Make our POST parameters string…
  var params;
  var whereclouse = document.getElementById("WhereClouse");
  var keyword = document.getElementById("KeyWord");
  var langcode = document.getElementById("LangCode");

  if (whereclouse.value != "") {params = "WhereClouse=" + encodeURI(whereclouse.value);}
  if (keyword.value != "") {params = params + "&KeyWord=" + encodeURI(keyword.value);}
  if (langcode.value != "") {params = params + "&LangCode=" + encodeURI(langcode.value);}
  if (str) {params = params + str;}
  // Set our POST header correctly…
  
  //alert (params);
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  // Send the parms data…
  http.send(params);

}

function getHttpRes() {
	  if (http.readyState == 4 && http.status == 200) { 
		  document.getElementById("ajaxsorgu").innerHTML=http.responseText;
	  }
}

function getXHTTP( ) {
	  var xhttp;
	   try {   // The following "try" blocks get the XMLHTTP object for various browsers…
	      xhttp = new ActiveXObject("Msxml2.XMLHTTP");
	    } catch (e) {
	      try {
	        xhttp = new ActiveXObject("Microsoft.XMLHTTP");
	      } catch (e2) {
	 		 // This block handles Mozilla/Firefox browsers...
		    try {
		      xhttp = new XMLHttpRequest();
		    } catch (e3) {
		      xhttp = false;
		    }
	      }
	    }
	  return xhttp; // Return the XMLHTTP object
	}





