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

168
Visualizações
use variable outside async function javascript

i'm trying to get the number of table line using javascript. i'm using php api with javascript. from the php side evry thing is good and i get the lines number with the javascript function below. the problem that's i want to use this variable outside this function .

note : inside function is working

      const readNumberListe = async () => {
        const data = await fetch("action.php?readNumberListe=1", {
          method: "GET",
        });
        const response = await data.json();// the response is 5 for exepmle 
        var number = response.number_parent ; 
        console.log(number) ; // i get 5 in the console 
    
      };
      readNumberListe();

// but i want to use or print 'number' here
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