<script type="text/javascript">
var time_variable;
function getXMLObject() //XML OBJECT
{
var xmlHttp = false;
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP") // For Old Microsoft Browsers
}
catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP") // For Microsoft IE 6.0+
}
catch (e2) {
xmlHttp = false // No Browser accepts the XMLHTTP Object then false
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers
}
return xmlHttp; // Mandatory Statement returning the ajax object created
}
var xmlhttp = new getXMLObject(); //xmlhttp holds the ajax object
function ajaxFunction() {
var getdate = new Date(); //Used to prevent caching during ajax call
if(xmlhttp) {
var b_firstname = document.getElementById("b_firstname");
var b_lastname = document.getElementById("b_lastname");
var b_address = document.getElementById("b_address");
var b_city = document.getElementById("b_city");
var b_state = document.getElementById("b_state");
var b_zip = document.getElementById("b_zip");
var b_phone = document.getElementById("b_phone");
var b_fax = document.getElementById("b_fax");
var b_cell = document.getElementById("b_cell");
var b_email = document.getElementById("b_email");
var b_comments = document.getElementById("b_comments");
xmlhttp.open("POST","testing.php",true); //calling testing.php using POST method
xmlhttp.onreadystatechange = handleServerResponse;
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send("b_firstname=" + b_firstname.value + "&b_lastname=" + b_lastname.value + "&b_address=" + b_address.value + "&b_city=" + b_city.value + "&b_state=" + b_state.value + "&b_zip=" + b_zip.value + "&b_phone=" + b_phone.value + "&b_fax=" + b_fax.value + "&b_cell=" + b_cell.value + "&b_email=" + b_email.value + "&b_comments=" + b_comments.value);
}
}
function ajaxSeller() {
var getdate = new Date(); //Used to prevent caching during ajax call
if(xmlhttp) {
var s_firstname = document.getElementById("s_firstname");
var s_lastname = document.getElementById("s_lastname");
var s_address = document.getElementById("s_address");
var s_city = document.getElementById("s_city");
var s_state = document.getElementById("s_state");
var s_zip = document.getElementById("s_zip");
var s_phone = document.getElementById("s_phone");
var s_fax = document.getElementById("s_fax");
var s_cell = document.getElementById("s_cell");
var s_email = document.getElementById("s_email");
var s_comments = document.getElementById("s_comments");
xmlhttp.open("POST","sellerins.php",true); //calling testing.php using POST method
xmlhttp.onreadystatechange = handleServerResponse;
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send("s_firstname=" + s_firstname.value + "&s_lastname=" + s_lastname.value + "&s_address=" + s_address.value + "&s_city=" + s_city.value + "&s_state=" + s_state.value + "&s_zip=" + s_zip.value + "&s_phone=" + s_phone.value + "&s_fax=" + s_fax.value + "&s_cell=" + s_cell.value + "&s_email=" + s_email.value + "&s_comments=" + s_comments.value);
}
}
function handleServerResponse() {
if (xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {
document.getElementById("message").innerHTML=xmlhttp.responseText; //Update the HTML Form element
}
else {
alert("Error during AJAX call. Please try again");
}
}
}
</script>
|