3. Fisher Game проблем с ajax и Kinvey
Направил съм си кинви проект и колекция, но когато направя ajax заявка получавам грешка в конзолата:
jquery-3.1.1.min.js:4 OPTIONS https://baas.kinvey.com/apdata/.../biggestCatches ...
index2.html:1 XMLHttpRequest cannot load https://baas.kinvey.com/apdata/.../biggestCatches. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.
Ето и кода:
const url = 'https://baas.kinvey.com/apdata/.../biggestCatches'
const headers = {
['Authorization']: 'Basic ...',
['Content-type']: 'application/json',
};
$('.add').on('click', function() {
let form = $('#addForm');
let data = {
angler: form.find('.angler').val(),
weight: form.find('.weight').val(),
species: form.find('.species').val(),
location: form.find('.location').val(),
bait: form.find('.bait').val(),
captureTime: form.find('.captureTime').val()
};
console.log(JSON.stringify(data));
$.ajax({
method: 'POST',
url: url,
headers: headers,
crossDomain: true,
data: JSON.stringify(data)
});
});
Пробвах и с другите видове аутентикация. Мисля че проблема е че прави cross-domain заявка и не знам как се оправя.
Какво правиш с " parseInputData " ??