У меня есть этот код, и он работает, как и ожидалось, при загрузке страницы, но когда я пытаюсь сделать этот вызов после проверки флажка, он будет показывать поле заголовка запроса x-csrf-token не разрешен Access-Control-Allow- Заголовки в предполетном ответе.
$.ajax
({
type: 'POST',
url: "https:/www.bb.com?uId=123&mId=123",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
beforeSend: function (xhr) { xhr.setRequestHeader("Authorization", "Basic dTHIgdfgsjdhgfsgfjhsfghsfkjs879"); },
dataType: 'json',
success: function (data) {
console.log(data);
},
error: function (xhr, status, error) {
console.log(xhr);
console.log(status);
console.log(error);
}
});
and for checking:
$("input:checkbox[name=list]").click(function () {
if ($(this).is(':checked')) {
do that call
}
});
Любая идея, как это единолично?