JavaScript SelectRows wait for end request

LabKey Support Forum (Inactive)
JavaScript SelectRows wait for end request jeckels  2014-11-28 12:22
Status: Closed
 
Hi Martin,

Yes, that's correct. The browser will send a request to the server, and when it gets the response at some point in the future, it will call your success function. This isn't specific to LabKey's JavaScript API - this is the standard pattern for how JavaScript code in web browsers makes calls to web servers.

The typical usage pattern is to use the success function to do whatever you need with availableQueries. In most cases, it's straightforward to simply put your code, say, right after your for loop inside the same function, instead of putting it outside of the callback function.

If you're not familiar with callbacks in JavaScript, this might give some useful background:

http://recurial.com/programming/understanding-callback-functions-in-javascript/

Thanks,
Josh