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

242
Vistas
why do i get [object Promise]

in a request fetch I always find [object Promise] This is my code:

async function getStartChat() {
        const response = await fetch("lib/start_chat.php")
        let data = await response.text();
        return data;
    }

let saveChat = getStartChat();
if(saveChat !== "") qCHAT.innerHTML = saveChat;

I also tried this other way:

async function getStartChat() {
        const response = await fetch("lib/bot.php").
        then(response => response.text()).
        then(data => { return data }).
        catch(err => console.log(err));
    }

but I always get the same answer

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

async functions always returns a promise.

if you want to use the value of the result you have to use .then

getStartChat().then(saveChat => {
    if(saveChat !== "") qCHAT.innerHTML = saveChat;

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