I am facing a problem in javascript array...i am using Serversent event in JS. I will be getting few values from server frequently...
My task is to catch all the details and display in drop-down box...
Now the problem is, during the first request, i will getting values seperated by comma.. I have array object in js...i will check if the array is empty, if so, then i will include the values in combo...
code:
var varArr = new Array();
//since i am using SSE, i will executing this below part multiple times automaticall when ever server pushes data..
if(!varArr.length){
varArr[0]='somevalue';
//Printing some value in <div>
}
else{
//some task...to print in <div>
}
Since i have added some values in array if the array is empty, i am not getting any values printed in div (//Printing some value in ), instead i am getting (//some task...to print in )