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

152
Views
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
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!