Multiple Requests In Sequence #443

woohoowebs opened this Issue Feb 25, 2013 · 3 comments


None yet

3 participants


Maybe this is because I am new to coding with Node.js or with asynchronous oriented programming... but I need some direction or an example as to how to achieve this.

I have some data scraping to do, but first I need my first request to login. I also have to get the next request to go on to another url to set something in the server to finally get the data I need on the third request.

When I try anything I know or have seen to make this work in series/sequence instead of operating all at once, it just keeps giving me random synchronous results - ending up in errors usually, because it tried to request a page when the login request hadn't yet completed.

Any help is greatly appreciated. Thank you!

mikeal commented Feb 25, 2013
// first request
request(url, function (e,r,b) {
  // second request
  request(url, function (e, r, b) {
@mikeal mikeal closed this Feb 25, 2013

Hmm, I've tried that but for some reason it was still doing it wrong. I'll try again. Thanks.

Also, if you happen to look at this again, - is there a more elegant way to do this? Maybe without so much nesting -like calling a function or something? This makes for having to do a lot of duplicated code..

ghprod commented May 11, 2014

try to use async module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment