Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
Ajax with No control for CORS CORB settings on server - How to show only certain element class of an external html object data with jQuery

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>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!