<form id="myForm" method="post" name="myForm"> NDA DOC: <input type="file" name="file1">
<input type="submit" id="submit">
</form>
thats the 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);
}
});
this code in wordpress site i'm getting this error (index):1 Access to XMLHttpRequest at 'http://www.example.com/uploader' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.