javascript - How to set global variable in query.on() -
var loadlatitude = ""; query.on("child_added", function(messagesnapshot){ var messagedata = messagesnapshot.val(); // gets key particular entry var key = messagesnapshot.getkey(); // create object var obj = {key:key, url:messagedata.url, longitude:messagedata.longitude, latitude:messagedata.latitude, filename:messagedata.filename}; arr.push(obj); loadlatitude = messagedata.latitude; s = s+ "<p align='center'><img src='" + messagedata.url + "' style=' border-style:solid; border-width:5px; border-radius:5px; margin-left: auto; margin-right: auto; width: 300px; height:300px;'/>"+messagedata.filename+messagedata.latitude+messagedata.longitude+"</p>"; $("#photolist").html(s); });
i retreive latitude , longitude firebase database. however, unable save global
variable.
Comments
Post a Comment