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 standard_price = document.getElementById("standard_price");var qty = document.getElementById("qty");var option1295 = document.getElementById("option1295");var option1297 = document.getElementById("option1297");var option1298 = document.getElementById("option1298");var option1299 = document.getElementById("option1299"); xmlhttp.open("POST","/ajax/ajax.item.php",true); //calling .php file using POST method xmlhttp.onreadystatechange = handleServerResponse; xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send("standard_price=" + standard_price.value + "&qty=" + qty.value + "&option1295=" + option1295.value + "&option1297=" + option1297.value + "&option1298=" + option1298.value + "&option1299=" + option1299.value); //Posting txtname to PHP File } } function handleServerResponse() { if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.getElementById("message").innerHTML=xmlhttp.responseText; //Update the HTML DIV element //document.getElementById("result").value=xmlhttp.responseText; //Update the HTML Input Form element } else { //alert("Error during AJAX call. Please try again"); } } }