On Nov 18, 2014 2:51 AM, Vasa <[email protected]> wrote:
>
> Hello noders
>
> i am trying to generate a chart (using highcharts) with queried data from Mysql.
[Snip]
> This is not working because the chart is drawn before the sql data is retrieved.
This is common as people start getting going in node. Move the drawing parts into the callback for the SQL query, so it waits until the data arrives.
Unlike php, request handlers don't just run to the bottom and stop. Instead, the top level is run which sets things up, which load data, which set things up and finally respond. Http responses aren't done until red.end(). That can be delayed as much as you need.
Next, you'll start nesting deeply, so http://callbackhell.com will be a short, good read for you.
Good luck!
Aria
--Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/546b4b65.89f5e50a.5f62.0ec4SMTPIN_ADDED_BROKEN%40gmr-mx.google.com.
For more options, visit https://groups.google.com/d/optout.
