what is .then for?

Posted 2 months ago by davy_yg

Hello,

I cannot understand what is .then is for?

Why even use .then? why not just goes with function(data){ }) without .then?

myForm.addEventListener('submit', function(e){

    e.preventDefault();
    var url = 'https://randomuser.me/api/?results=10';
    axios.get(url)
    .then(function(data){
    
        console.log('enter then');
    })

})

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.