Ajax'ом обращаюсь к Django:
$(document).ready(() => {
$("#end-of-registration").click((e) => {
e.preventDefault();
$.ajax({
type: "POST",
/*url: "http://localhost:8000/registration",*/
url: "http://localhost:8000/registration",
dataType: "text",
success: function(data)
{
console.log(data);
}
});
});
В вьюхе возвращаю ответ (return HttpResponse('some text')
), но в консоли выпадает ошибка:
Failed to load http://localhost:8000/registration: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Нужно установить в HttpResponse
заголовок 'Access-Control-Allow-Origin: *', но пока все способы оборачиваются неудачей