Page 1 of 1

JSON request local variable

Posted: Thu Dec 05, 2013 3:37 am
by Abdelrahim

Hi I am following your Geospatial Queries example to create a function. I have created the database service with a where request parameter. I test the following code and it executes successfully:

{ "Location" : { "$nearSphere" : [39.077309,-77.398537], "$maxDistanceInMiles" : 100 } }

I want to replace the hardcoded Latitude and Longitude coordinates with a locally stored geolocation latitude and longitude. I have successfully stored and called the lat and lon in another portion of the program but can't seem to do the same for the database service request. In mapping with the where parameter I use the following javascript: var jsonback = { "Location" :{"$nearSphere" : [return localStorage.getItem('lat') + ',' + localStorage.getItem('log')], "$maxDistanceInMiles" : 100}
};
return jsonback;

But it doesn't work, do you have any suggestions?


JSON request local variable

Posted: Thu Dec 05, 2013 5:07 am
by Alena Prykhodko

Hello Abdelrahim,

Please check browser console if there are any errors http://docs.appery.io/documentation/d...