Update of JS global variables

Asked

Viewed 22 times

0

I have the following function:

async function openModal() { // função chamada por um botão
                 buscarPessoas();
                $('#Mymodal').modal({
                    backdrop: "static",
                    keyboard: false
                })
            }

async function buscarPessoas() {
                await AgendamentoService.getOne(localStorage.getItem('agendamentoID')).success((res) => {
                    PessoaService.getOne(res.pessoaID).success((res) => {
                        console.log(res, '<')
                        $scope.pessoaNome = res.nome
                        $scope.pessoaCpf = res.cpf
                    })
                })

my problem is that my "personal" and "personal" variables are only updated within the function itself, I cannot use them at other points of the code.

The variables mentioned above will be used within the modal that will be opened. However, I cannot update.

Some solution?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.