I only have access to the Front-End so I can’t really set Access-Control-Allow-Origin to * on the server. That’s why I struggling with jsonp, corb in the second snippet below. And the only thing works seems to be the first snippet where I can show a whole html object, but then I need only to show the element span class="bar so a solution in my case would be to filter a data object html and finally show only element span class="bar
Again I am trying to show only element span class="bar of this external html object data
$(document).ready(function(){
$("#y").html('<object data="https://www.osculati.com/it/advancedSearchResults.aspx?searchbar=49.548.04" />');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="y"></div>
But when I am using jQuery Ajax either .load method, I first get CORS error. So to solve cross domain issue I use Jsonp and then I get CORB error so I got stuck
$(document).ready(function() {
$.ajax({
url: "https://www.osculati.com/it/advancedSearchResults.aspx?searchbar=49.548.04",
dataType: 'jsonp',
success: function(json) {
alert("Success");
},
error: function() {
alert("Error");
}
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
this should do what you want
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<div id="y"></div>
<script>
$(document).ready(function() {
$("#y").load('https://www.osculati.com/it/advancedSearchResults.aspx?searchbar=49.548.04 .bar')
});
</script>
</body>
</html>
I hope this helps