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: " “”.

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 = ;“POST”, “” + 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”);