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

153
Visualizações
Append HTML in Javascript in new page

I have many cars readed from back4app i want just when i click in name of a car they take me to car_detail.html and append my template html of car details of car clicked and when i click in another car take to same page but with detail of second car.this is link of my site to be more

(async () => {
        
  const query = new Parse.Query('cars');
  // You can also query by using a parameter of an object
  
  const results = await query.find();
  
  try {
    for (const cars of results) {
      // Access the Parse Object attributes using the .GET method
      const obj = cars.set('objectId');
      const brand = obj.get('car_brand');
      const year  = cars.get('car_year');
      const seat  =cars.get('car_seat');
      const fuel  =cars.get('fuel_type');
      const speed = cars.get('car_speed');
      const consume=cars.get('car_consume');
      const price =cars.get('car_price');
      let sub_brand=brand.substring(0,2);
      
      $(".cars").append(`<tr>
      <td>
      <a id="${brand}${year}"  class="d-flex align-items-center brand">
      <div class="m-r-10"><div
              class="btn btn-circle d-flex btn-info text-white">${sub_brand}</div>
      </div>
      <div class="">
          <h4 class="m-b-0 font-16">${brand}</h4>
      </div>
  </a>
      </td>
      <td>${year}</td>
      <td class="col-sm-1">${seat}</td>
      <td>
          <label id="fuel-color" class="badge rounded-pill bg-warning">${fuel}</label>
      </td>
      <td>${consume} Km/1litres</td>
      <td><label class="badge bg-danger">${speed}</label></td>
      <td>
          <h5 class="m-b-0">${price} TND</h5>
      </td>
  </tr>`);
  $("#"+brand+year).attr(`href`,`car_details.html#`+brand+year);
  
      
    }

  } catch (error) {
    console.error('Error while fetching cars', error);
  }
  
})(); 
async()=>{
const query = new Parse.Query('cars');
const results = await query.find();
for (const cars of results) {

  const brand = obj.get('car_brand');
  const year  = cars.get('car_year');
$(document).on('click', '#'+brand+year,async function(){
  let r = await fetch("html_fetch/car_detail_view.html");
let t = await r.text();

 $(`.car_details_view`).append(t);
});
}}
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