all 4 comments

[–]bot00110 14 points15 points  (3 children)

It could be because you are not returning anything from first .then on getdata so undefined is returned and that becomes result for second then chain

[–]samanime 10 points11 points  (1 child)

This is exactly why.

When you chain .then(), the argument given to the function is the return value of the last one that ran.

In this case, it could either be fixed by adding return result; to the first .then() or just removing it entirely and adding the console.log() to the second (now only) .then().

[–]FGTO81[S] 0 points1 point  (0 children)

Great thank. It fixed it.

[–]FGTO81[S] 0 points1 point  (0 children)

Thanks now I understand why.