<form id="myForm" method="post" name="myForm"> NDA DOC: <input type="file" name="file1">
<input type="submit" id="submit">
</form>
это js
$('#myForm').submit(function(e){
e.preventDefault();
let data = $( this ).serialize()
$.ajax({
type: "POST",
url: "http://www.example.com/uploader",
data: data,
success: function(response){
// success action here
console.log(response);
},
error: function(response) {
// error action here
console.log(response);
}
});
этот код на WordPress сайте, я получаю эту ошибку (индекс): 1 Доступ к XMLHttpRequest на «http://www.example.com/uploader' от источника» http://localhost:8080' заблокировано политикой CORS: в запрошенном ресурсе отсутствует заголовок «Access-Control-Allow-Origin».