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

223
Visualizações
how do I get a tables data from a website using javascript?

I am trying to take data's from my university website and am using javascript fully. Is there a way to take data's in each row and add them to the table in my website ? These data's Data's needed This is the website https://banner.kfu.edu.sa:7710/KFU/ws?p_trm_code=144310&p_col_code=09&p_sex_code=11

When I tried to do it using my code My javascript

This is the result I'm getting Result

My code

 <table id="myTable" style="width:100%" >
    <tr>
      <th>Course name</th>
      <th>Section</th>
      <th>Time</th>
      <th>Instructor name</th>
      <th>CRN</th>
    </tr>
  </table>
    
  </div>

 

 <script>
    var table = document.getElementById("myTable");
  
    var xhr = new XMLHttpRequest();

    xhr.open("Get","https://banner.kfu.edu.sa:7710/KFU/ws?p_trm_code=144310&p_col_code=09&p_sex_code=11");
    xhr.responseType = "document";

    xhr.onload = function(){

      if(xhr.readyState == 4 && xhr.status==200){
      //copies the entire xml of the web page
        var response = xhr.responseXML.querySelectorAll(".normaltxt");
        var row = table.insertRow(1);
        
        response.forEach(function(numbers)
        { var courseNameCell = row.insertCell(0);
          courseNameCell.innerHTML = response.table;
          
        })
        console.log(response);
        
      }
      
    };
     xhr.onerror = function(){
       console.error(xhr.status, xhr.statusText);
    
     }
     xhr.send();

  </script>

about 4 years ago · Santiago Trujillo
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