Here's my code:
var formData = new FormData();
for (var i = 0; i < ctx.fileData.length; i++) {
formData.append('file', ctx.fileData[i]);
}
// now post a new XHR request
var xhr = new XMLHttpRequest();
xhr.open('POST', '/site-manager-gateway/add-content');
xhr.onload = function () {
if (xhr.status === 200) {
console.log('all done: ' + xhr.status);
} else {
console.log('Something went terribly wrong...');
}
};
xhr.send(formData);
I get an error:
POST http://dev-site.net/site-manager-gateway/add-content 405 (Method Not Allowed)
But I'm posting to the same domain.
Where am I going wrong?
EDIT, PHP file (site-manager-gateway):
public function addContent()
{
var_dump('a');
die();
}