browser lang:en
After a while of search i found this easy way to import in my site JSON datas from external domains.
All is made in javascript and it don't needs particular AJAX frameworks, really easy, don't you think?
Example:
<script type="text/javascript">
function results(obj) {
var rssoutput="<h1>Find meteo for locality (coords)</h1>"
rssoutput+= 'Clouds:'+obj.weatherObservation.clouds+'<br>';
rssoutput+= 'weatherCondition:'+obj.weatherObservation.weatherCondition+'<br>';
rssoutput+= 'observation:'+obj.weatherObservation.observation+'<br>';
rssoutput+= 'windDirection:'+obj.weatherObservation.windDirection+'<br>';
rssoutput+= 'elevation:'+obj.weatherObservation.elevation+'<br>';
rssoutput+= 'countryCode:'+obj.weatherObservation.countryCode+'<br>';
rssoutput+= 'lng:'+obj.weatherObservation.lng+'<br>';
rssoutput+= 'temperature:'+obj.weatherObservation.temperature+'<br>';
rssoutput+= 'dewPoint:'+obj.weatherObservation.dewPoint+'<br>';
rssoutput+= 'windSpeed:'+obj.weatherObservation.windSpeed+'<br>';
rssoutput+= 'humidity:'+obj.weatherObservation.humidity+'<br>';
rssoutput+= 'stationName:'+obj.weatherObservation.stationName+'<br>';
rssoutput+= 'datetime:'+obj.weatherObservation.datetime+'<br>';
rssoutput+= 'lat:'+obj.weatherObservation.lat+'<br>';
rssoutput+= 'hectoPascAltimeter:'+obj.weatherObservation.hectoPascAltimeter+'<br>';
rssoutput+= '<br><br><br>';
//document.write(rssoutput);
var txt = document.getElementById("meteo");
txt.innerHTML=rssoutput;
}
function dynamicScript(url){
var script=document.createElement('script');
script.src=url;script.type="text/javascript";
document.getElementsByTagName('head')[0].appendChild(script);
}
dynamicScript('http://ws.geonames.org/findNearByWeatherJSON?lat=39.542500&lng=2.594500&callback=results');
</script>
<div id="meteo"></div>
Have you ever had to develop something yourself only to find out that there had already been…
in:JQuery (0 comments)The situation begins with your blog or website and you need to post some code on a particular…
in:The Holy Faq's (0 comments)So. Google just recently announced Google Buzz. I’m not sure about you, but I…
in:Blog (0 comments)There's lots of clever scripts around to tell you how to get images in and out of…
in:PHP scripts (0 comments)Spherical Law of Cosines Suppose that we want to find the five nearest places to (47.470779, -87.890699) using Spherical…
in:MySql (0 comments)I have always used Dreamweaver, and love it. But, I have been thinking, what are the FREE CSS…
in:Free Software (0 comments)Advanced Linux Sound Architecture (known by the acronym ALSA) is a Linux kernel component intended to replace the…
in:Blog (0 comments)The Singleton Pattern is one of the GoF (Gang of Four) Patterns. This particular pattern provides a…
in:Scripts and tutorials (0 comments)
