Good. I am doing a dart program that retrieves the user's location and then changes the geographic location (openmapsapi) and then displays the news with a specific city name (google news api)
I use the following code for openmap api and get the city in local storage. From there I want to use a similar code for google news api, but it throws an error, maybe two lines of window.on.data cannot be added. Part of the code was taken from Seth Ladd’s blog, and I don’t know a bit how everything works.
window.on.message.add(locReceived);
Element script = new Element.tag("script");
var somelat=window.localStorage.$dom_getItem("LAT");
var somelng=window.localStorage.$dom_getItem("LNG");
var someurl="http://nominatim.openstreetmap.org/reverse? format=json&lat="+somelat+"&lon="+somelng+"&addressdetails=1&json_callback=callbackForMapsApi";
script.src=someurl;
document.body.elements.add(script);
This is my corresponding html code that I use
<script type="text/javascript">
function callbackForJsonpApi(s) {
window.postMessage(JSON.stringify(s), '*');
}
function callbackForMapsApi(s) {
window.postMessage(JSON.stringify(s), '*');
}
</script>
Not really working on web technologies, any help would be appreciated.
source
share