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);
});
}}