I use this script, to get some data via ajax request:
jQuery(document).ready(function() {
$urlpre = document.location.protocol;
$.ajax({
url: $urlpre+'//domain.tld/file.php',
error: function (thrownError) {
pushNotify('Could not connect to update server!', 'danger', '5');
},
success: function (data) {
...
}
});
});
Now the url changed from domain.tld/file.php
to sub.domain.tld/file.php
.
I set up a 301 redirect and in the browser this works fine, but the ajax request throws me the error.
I tried to google the issue, some have problems with http: and https:, but I don't think that's my case.