I would like to know why this code works on firefox, chrome and IE10, but not in IE9
var ajaxReq = new XMLHttpRequest(); var params = "name="+$('#name').val() var url = "register.php"; ajaxReq.open("POST", url, true); ajaxReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ajaxReq.setRequestHeader("Content-length",params.length); ajaxReq.setRequestHeader("Connection", "close"); ajaxReq.onreadystatechange = function(){ if(ajaxReq.readyState == 4 && ajaxReq.status == 200) {alert(ajaxReq.response)}
The code contained in the php file itself does not matter, because for some evidence I shoot it very minimally:
header('Content-Type: text/json'); echo 'response'; exit;
source share