I can use jQuery for fast drafting / prototyping but I can not YET implement it on our production servers.
I need assistance with getting the plain javascript version of the following to work. In the plain javascript version submit.php is not receiving the json data.
Original jQuery:
$.ajax({
type: "POST",
url: "submit.php",
data: json,
dataType: "json",
success: function(json){
alert('success');
}
});
Plain javascript:
var xmlhttp;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST","submit.php",true);
xmlhttp.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
xmlhttp.send(json);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
alert('success');
}
}