I currently have a function that sends one output, which is 'OPTIONS', as JSON using AJAX. Now I am looking to modify this function in order to POST multiple outputs, let's say two values. How can I adjust this function to handle two values for POST request? Here's the AJAX function I'm using.
function ADDLISITEM(form)
{
var options = form.txtInput.value;
options = JSON.stringify(options);
var url = "send_mysql.php";
var request = null;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
request=new XMLHttpRequest();
}
else
{// code for IE6, IE5
request=new ActiveXObject("Microsoft.XMLHTTP");
}
request.open("POST", url, true);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.setRequestHeader("Connection", "close");
request.onreadystatechange = function(){
if (request.readyState == 4) {
if (request.status == 200) {
//alert('POST');
} else {
alert(request.status); // fails here
}
}
}
request.send("options=" + encodeURIComponent(options).replace(/%20/g, '+'));
}
</script>