var formElement = document.getElementById("myFormElement"); var xhr = new XMLHttpRequest(); xhr.open("POST", "submitform.php"); xhr.send(new FormData(formElement));