Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda