| Галина123 | 
			21.08.2020 17:40 | 
		 
		 
		
		 
		
		
			не отправляются данные через ajax   
		
		
		
		подскажите, пожалуйста, почему при передаче данных с помощью ajax на PHP приходит пустой массив 
function ajax(url, method, functionName, dataArray) {
    let xhttp = new XMLHttpRequest();
	xhttp.responseType ="json";
    xhttp.open(method, url, true);
	
    xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhttp.send(dataArray);
    xhttp.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
            functionName(this);
        }
    }
}
function requestData(dataArr) {
    let out = '';
    for (let key in dataArr) {
        out += `${key}=${dataArr[key]}&`;
    }
    console.log(out);
    return out;
}
ajax('data.php','POST', check, data);
function check(){//
	console.log(this);
}
let data = {
    "name": "Sasha",
    "age": 22
}
 
	 |