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

256
Visualizações
How to print multiple object json data into html table with set interval?

I want to print json (response) into an html table. i want the following information in the table.

  1. Tracking id = data.items.tracking_id
  2. Update Date = data.items.origin_info.trackinfo.z9.z1.date
  3. Current City = data.items.origin_info.trackinfo.z9.z1.Details
  4. Current Status = data.items.origin_info.trackinfo.z9.z1.checkpoint_status

here is my code setup.

const settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://order-tracking.p.rapidapi.com/trackings/realtime",
    "method": "POST",
    "headers": {
        "content-type": "application/json",
        "x-rapidapi-host": "order-tracking.p.rapidapi.com",
        "x-rapidapi-key": "c1b4466148msh84c499d6e5590c4p155c1bjsne8487b7633cc"
    },
    "processData": false,
    "data": {
        "tracking_number": "CM436202938IN",
        "carrier_code": "india-post"
    }
};

setInterval(function() {
$.ajax(settings).done(function (response) {
//console.log(response);
      var sdata = '';
      $('#trackinfo').empty();
      $.each(response, function(key,value){
        sdata += '<tr>';
        sdata += '<td>'+value.data.items.tracking_number+'</td>';
        sdata += '<td>'+value.data.items.origin_info.trackinfo.z9.z1.date+'</td>';
        sdata += '<td>'+value.data.items.origin_info.trackinfo.z9.z1.Details+'</td>';
        sdata += '<td>'+value.data.items.origin_info.trackinfo.z9.z1.checkpoint_status+'</td>';

        sdata += '</tr>';
      });
       $('#trackinfo').html(sdata);
 }); }, 50000);
<table class="">
<thead>
<tr>
<th>Tracking ID</th>
<th>Update Date</th>
<th>Current City</th>
<th>Current Status</th>
</tr>
</thead>
<tbody id="trackinfo">

</tbody>

</table>

I am unable to get tracking information inside the html table. pls improve the code so the tracking information will be reflected inside the html table.

about 4 years ago · Juan Pablo Isaza
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