I have an HTML page at the following address:
https://www2.casailaria.it/news/
I wish I could read some elements of the DOM with an http call via javascript.
I'm trying them all, but I still have that damned console error: CORS header "Access-Control-Allow-Origin" missing
.
I tried the following ajax call without success, studding it with alleged parameters:
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8" />
<title>MAURIZIO</title>
<link rel="stylesheet" type="text/css" href="background.css">
</head>
<body>
<script src="https://code.jquery.com/jquery-3.5.1.js"
integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<script>
$.ajax("https://www2.casailaria.it/news/", {
dataType: "jsonp",
cors: true,
secure: true,
headers: {
'Access-Control-Allow-Origin': '*', // or 'Access-Control-Allow-Headers: x-requested-with'
},
success: function (response) {
console.log(response);
}
});
</script>
</body>
</html>
I hope I'm not too far from the solution, and I think I'm going around it. Once obtained I would simply like to do operations like: response.getElementsByClassName('myClassOfOtherPage')
What do I have to add/remove to make it work well?
Other javascript solutions are welcome as well as ajax calls, as long as they are part of the CDN.
Thanks in advance!