Main Menu




browser lang:en

Users Area

Client Login

today cache size is:82392

 

Holyguard rss
rss 2.0 for all sections

 

Portfolio

Some of my projects:
BluPool
L'Pratone
Travel in Hotel
Yacht Elements
AbruzzoWeb
Il Mastino
CSI Teramo
Innovazione S.p.a.




Comments

attached files not working !
05/11/2009 by Adnan
Tuvok
14/02/2009 by
Nice script
07/02/2009 by desaj
Other solutions
07/02/2009 by Mike
well
06/02/2009 by holy
Theif
06/02/2009 by
really good
02/11/2008 by

Read More »


RAPIDQ

Rapid-Q:The lost files
My old library where i have collected all the rapidq scripts and italian help


Today my pagerank is: Free Page Rank Tool

JSON-JS - Cross Site Scripting with JSON and Javascript

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>


In the practice, for consume external JSON, i simulate that this is an external javascript code. External javascripts aren't blocked by browsers.
Then i call the name function with callback and apply it in the script.

Have a nice practice.

 

Rating:
100.0
1 votes
1 2 3 4 5

Comments

Nice script by desaj

07/02/2009 
Nice, rapid and powefull


Other solutions by Mike

07/02/2009 
Could you show other JSON solutions?


Insert your comment

Titolo
Messaggio
Nome Utente
e-mail (se vuoi ricevere le risposte a questo post anche via mail)

Videos


Contents

Complete guide for Jquery Developers

27/02/2010 

Have you ever had to develop something yourself only to find out that there had already been…

in:JQuery (0 comments)

How can i insert HTML code in my posts?

14/02/2010 

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)

12 undocumented tricks for Google Buzz

14/02/2010 

So. Google just recently announced Google Buzz. I’m not sure about you, but I…

in:Blog (0 comments)

Display an image from a MySQL database in a web page via PHP

14/02/2010 

There's lots of clever scripts around to tell you how to get images in and out of…

in:PHP scripts (0 comments)

MySQL - Find Locations Nearest Known Coordinates

03/02/2010 

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)

The 7 free best CSS editors

01/02/2010 

I have always used Dreamweaver, and love it. But, I have been thinking, what are the FREE CSS…

in:Free Software (0 comments)

Upgrade to Alsa 1.0.20 on Ubuntu Jaunty 9.04

09/01/2010 

Advanced Linux Sound Architecture (known by the acronym ALSA) is a Linux kernel component intended to replace the…

in:Blog (0 comments)

PHP - The Singleton Pattern

26/11/2009 

The Singleton Pattern is one of the GoF (Gang of Four) Patterns. This particular pattern provides a…

in:Scripts and tutorials (0 comments)

Read more »


Tag Clouds


Complete guide Jquery DevelopersHow insert HTML code posts12 undocumented tricks Google BuzzDisplay image from MySQL database page PHPMySQL Find Locations Nearest Known CoordinatesThe free best editorsUpgrade Alsa 1020 Ubuntu Jaunty


Add to Technorati Favorites