Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

268
Vistas
here rec.title is string and it not get passed as shown why?

output+=<td> <button onclick='addFavourite(${rec.id},${rec.Title},${rec.Posterpath})'>Add to Favourites</button></td>;

This is the fuction which take arguments, and add it into the favourite part in json, using fetch, and also it also display at web as a table.

function addFavourite(value,title,poster) {

let ind=  itemarr.findIndex( ele=>ele.id==value);
datastore= {
    "id": value,
     "Title" : title,
     "Posterpath": poster
    }
    fetch("http://localhost:3000/favourites",{
"method":"POST",
"headers":{"content-type":"application/json"},
body:JSON.stringify(datastore)
 })
.then(
        res=>
        {
        
            console.log("Added");
            itemarr2.push(datastore);
            displayproduct2();
            
        }
)
.catch(
    err=>console.log(err)
)
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda