At the moment I'm trying to make a POST request to a custom field in Wordpress (see code below). But whatever I try the browser stays giving the error: Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR. The weird part of the story is that making the POST request in Postman works! I tried to edit the .htaccess file with adding the rule Header set Access-Control-Allow-Origin "*" but that also didn't work. Hopefully someone can help me.
Code:
$( "#confirmButton" ).click(function() {
var form = new FormData();
form.append("fields[email]", "randomemail@hotmail.com");
var settings = {
"url": "https://domainname.com/wordpress/wp-json/wp/v2/blogs",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer <my-token>"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
});
At the moment I'm trying to make a POST request to a custom field in Wordpress (see code below). But whatever I try the browser stays giving the error:
Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR
. The weird part of the story is that making the POST request in Postman works! I tried to edit the.htaccess
file with adding the ruleHeader set Access-Control-Allow-Origin "*"
but that also didn't work. Hopefully someone can help me.Code: