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