Click here to Skip to main content
15,559,974 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I have came across a situation, i have develped application on Node JS platform which fetches data from Sqlite Database.

I have taken global variable on server.js which is nothing but a NodeJS code.
This global variable i have declared at the top of server.js like
var UniqueUsers;

And i am assigning this variable a value in Node JS method.
UniqueUsers = JSON.stringify(result);
Where result is nothing but data from Sqlite DB.

I am using Kendopivot grid to render data. This grid have link button/anchor tag. When i click on them then i am fetching record from above UniqueUsers variable based in some condition and showing user information on popup window.

I am dynamically creating HTML file and accessing above variable as :-
<pre lang="Javascript">
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />\r\n<meta charset="utf-8" />

var unique_user =' + UniqueUsers + ';
//dynamically creating html tags
//showing user information

This is perfectly working on my local environment. Everytime when i click on link, user information shows.
I mean JSON variable is not undefined.

However when i access my site on production server and click on any links then JSON is undefined.
Then nothing happens and loading image is showing. Data does not load.
No error has been raised.
Even I am printing json result on console. But it dsplays as undefined.
First time when i click on link - then json is undefined.
Second time when i click on link - it shows records.
Third time when i click on link - json is undefined.
Meaning every alternate, it's happening.

I verified all the css and js files on server and all placed on right place.
On chrome, it's working but sometimes also getting undefined.

Sometimes when i change IE compatibility mode from edge to 10 or 10 to Edge, then it works.

I am also wondering why this happens on server side.
Can anybody let me know please. What would be causing json to undefined.

What I have tried:

I have tried all my way but not able to resolve above issue.
And as already said that, on local environment it's working.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900