I have been recently working on WordPress and trying to create sessions however I'm facing the following issue:
- I have created my own PHP file, where I will get the POST data and assign it to session variable.
- I have created the following function in Theme Footer file:
if(document.getElementById("size")) { var sizeSelect = document.getElementById("size"); sizeSelect.addEventListener("change", function(){ var size=document.getElementById("size").value; if(size=="Custom Size") { document.getElementById("measurementChart").style.display = "block"; } else { clearCookies(); } }); }
function closeMeasurementWindow() {
document.getElementById("measurementChart").style.display = "none";
}
function saveMeasurementCart() {
if(document.getElementById('feet').value == "" || document.getElementById('inches').value == "" || document.getElementById('shoulder').value == "" || document.getElementById('neckdepthback').value == "" || document.getElementById('bust').value == "" || document.getElementById('neckdepthfront').value == "" || document.getElementById('belowbust').value == "" || document.getElementById('armaround').value == "" || document.getElementById('waist').value == "" || document.getElementById('armhole').value == "" || document.getElementById('lowwaist').value == "" || document.getElementById('thighround').value == "" || document.getElementById('hip').value == "" || document.getElementById('kneeround').value == "" || document.getElementById('sleeve').value == "" || document.getElementById('calfround').value == "" || document.getElementById('toplength').value == "" || document.getElementById('bottomround').value == "") {
clearCookies();
alert("Values Caot Be Empty");
retu false;
} else {
var xhttp = new XMLHttpRequest();
var pname = document.getElementsByClassName('product_title')[0].ierHTML;
var size = 'Custom Measurement';
var heightFeet = document.getElementById('feet').value;
var heightInch = document.getElementById('inches').value;
var shoulder = document.getElementById('shoulder').value;
var nechDepthBack = document.getElementById('neckdepthback').value;
var bust = document.getElementById('bust').value;
var neckDepthFront = document.getElementById('neckdepthfront').value;
var belowBust = document.getElementById('belowbust').value;
var armRound = document.getElementById('armaround').value;
var waist = document.getElementById('waist').value;
var armHole = document.getElementById('armhole').value;
var lowWaist = document.getElementById('lowwaist').value;
var thighRound = document.getElementById('thighround').value;
var hip = document.getElementById('hip').value;
var kneeRound = document.getElementById('kneeround').value;
var sleeveLength = document.getElementById('sleeve').value;
var calfRound = document.getElementById('calfround').value;
var topLength = document.getElementById('toplength').value;
var skirtBottomRound = document.getElementById('bottomround').value;
var specialInstructions = document.getElementById('instructions').value;
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
console.log("success");
}
};
xhttp.open("GET", "http://localhost/ayeshaaejaz/custom_measurement.php?pname=" + pname + "&size=" + size + "&heightFeet=" + heightFeet + "&heightInch=" + heightInch + "&shoulder=" + shoulder + "&nechDepthBack=" + nechDepthBack + "&bust=" + bust + "&neckDepthFront=" + neckDepthFront + "&belowBust=" + belowBust + "&armRound=" + armRound + "&waist=" + waist + "&armHole=" + armHole + "&lowWaist=" + lowWaist + "&thighRound=" + thighRound + "&hip=" + hip + "&kneeRound=" + kneeRound + "&sleeveLength=" + sleeveLength + "&calfRound=" + calfRound + "&topLength=" + topLength + "&skirtBottomRound=" + skirtBottomRound + "&specialInstructions=" + specialInstructions, true);
xhttp.send();
document.getElementById("measurementChart").style.display = "none";
}
}
With these functions, I'm able to show a popup, having various fields. Now when customer saves the field, I made an ajax call, that calls, my PHP(that i have created). However, this is not working and I'm out of idea, as what to do. I tried registering functions, but failed miserable. Any kind of help would be appreciated.
