My ajax request looks like this:
$.ajax({
url: self.opts.url.replace('//www.', '//'),
type: 'POST',
...
});
I put that .replace just to be sure. Because my URL in opts.url is "http://website.com/admin/upload-image/123". But I can't upload an image, because I get an error in the console: XMLHttpRequest cannot load http://www.website.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://website.com' is therefore not allowed access.
I double-checked the URL in debug mode and it is always without a www., but jQuery seems like adding it anyway. This doesn't make sense for me at all.
Also what I get from jQuery's error function:
jqXHR: Object (filled statusText with "error")
textStatus: "error"
errorThrown: ""