Need help to create Projects with Gitlab API in Javascript

Hey guys,
I try to create a Project with the API via URL(XMLHttpRequest), but i don’t know where to put the Private Token in the Function.

I got this working in the Bash: curl --request POST --header "PRIVATE-TOKEN: " “https://gitlab.com/api/v4/projects?name=foo”.

Now i try to do the same, but with an URL:
I created this Function:
function createProject() {
var projectName = document.getElementById(‘project_name’).value;
var req = new XMLHttpRequest();
var arr = ;
req.open(“POST”, “https://gitlab.com/api/v4/projects?name=DASDA” + projectName, true);
req.onload = function () {
jsonResponse = JSON.parse(req.responseText);
for (var i in jsonResponse) {
var ul = document.getElementById(“list”);
var li = document.createElement(“li”);
li.appendChild(document.createTextNode(jsonResponse[i].name));
ul.appendChild(li);
}
};
req.send(null);
}