Код: Выделить всё
const xhr = new XMLHttpRequest();
xhr.onload = function(e) {
if(this.readyState === 4) {
console.log("Server returned: ",e.target.responseText);
}
};
const fd = new FormData();
fd.append("courseName", 'Math');
xhr.open("POST", "upload.php", true);
xhr.send(fd);
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/663 ... s-expected