[nodejs] Re: Use of global variable in node js

2017-03-29 Thread SURAJ KUMAR CHANDRA
Thanks mate. But I am still finding it difficult to convert my above logic to make it async and return login data. I think I need to use multiple callback. On Wednesday, March 29, 2017 at 2:00:20 PM UTC-5, Julia Y wrote: > > Hi there, I don't know, will it be interesting for you, but think that

[nodejs] Re: Use of global variable in node js

2017-03-28 Thread SURAJ KUMAR CHANDRA
login function > con.execQuery initiates query > return from login function (result variable is still empty array) > > > later: > > node event loop invokes the callback > rows is assigned to result variable (too late, login returned before) > > > On Tuesday, March 2

[nodejs] Use of global variable in node js

2017-03-27 Thread SURAJ KUMAR CHANDRA
How do you guys use node js vars. Please refer to red marking. I am declaring variable at one place trying to use at another place, simply not working. function login(email,password){ // Returns the login data row var email = email.trim().toLowerCase(); var password = password.trim();

[nodejs] How to returned array from node js function to calling statment

2017-03-20 Thread SURAJ KUMAR CHANDRA
Hi, I have requriement to return array from node js I want to retrun result like below. Any help will be appreciated. [ 'SUCCESS','','Msg','DB connection was successful'] Calling file var fn = require("./sql.js"); var mysql = require("mysql"); var con = mysql.createConnection({ host: