Home Firefox Async/Await Promise problems
Reply: 0

Firefox Async/Await Promise problems

user968
1#
user968 Published in May 21, 2018, 9:05 am

I have a site working well in Chrome but when launched in Firefox I have a problem with the promise/await.

I have the next code:

if (await verifica(document.getElementById('uniqueidPruebasGrupo').value) == "false")
    functionA();
else
    functionB();


function verifica (codigo)
{
    return new Promise(resolve => {
        $.ajax({
        url: "cms/verificaCodigoPrueba.php",
        data: "uniqueidPruebasGrupo=" + codigo,
        type: "POST",  
        success: function(response){   
            if (response == "ok")
                resolve("true");
            else
                resolve("false");
        }
        }); 
    }); 
}

This code waits until ajax answer and then executes the functionA or functionB.. In chrome the code works perfect but in Firefox a new tab is oppened with the text "[object promise]" and nothing occurs.

Can anybody help me?

Thanks on advance.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.466051 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO