Send form results to a server

Send form results to a server
0

i am new here.Help would be appreciated.
ERROR: Uncaught ReferenceError: FormData is not defined,

var xhr = new XMLHttpRequest();
// POST to httpbin which returns the POST data as JSON
xhr.open(‘POST’, “https://localhost/sqlconnect/register2.php”);

    var formData= new FormData();

      formData.append("name",this.userNameField.string);
      formData.append("password",this.passNameField.string);
      xhr.send(formData);               // ERROR: Uncaught ReferenceError: FormData is not defined,
      console.log(xhr.response);

    xhr.send(formData);

Have you tried to create an object outside of the formData.append() then passing that as a paramter? For instance,

var someData = {
   "name" : this.userNameField.string,
   "password" : this.passNameField.string
}

formData.append(someData);