I try to reach out to the IKEA Api to access the availability checker. If I want to ajax the file it wont return anything and the .fail function is called.
$('#availability').submit(function (event) {
let productNumber = $('#productId').val();
if (testString(productNumber, '^[0-9]{3}\.[0-9]{3}\.[0-9]{2}$')) {
productNumber = productNumber.replace(/\./g, '');
let target = 'http://ikea.com/de/de/iows/catalog/availability/' + productNumber;
$.ajax({
url: target,
cache: false,
dataType: 'xml'
})
.done(function (data) {
console.log('succes');
})
.fail(function (x) {
console.log(x);
});
}
event.preventDefault();
});