Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm after finding out how to get a live data feed of weather on my website for a certain town or place.
Also it's not going to be any bigger than 103x50 pixels.
Thanks for any tips websites etc...
ian

Weather.com has an XML feed. An excellent example of this uses openrico. Of course, you can format the data as you please.

anonproxy:
Do you know how to use the weather section on your own page. I can't get it to work, but would like to. It looks really great.
http://openrico.org/demos.page?demo=ricoWeather.htmlThanks

Last I checked, XMLHTTPRequest only works within one domain. So a page retrieved from one domain can only make requests to that domain. An html document (and corresponding javascript) retrieved from a local file cannot communicate with anything but the localhost. Neither can a page from, say your website, communicate with openrico.org.
I just downloaded and toyed with the example. Everything worked fine except for the data transfer. The example requires some server-side functionality to work.
Notice this function in the html:
function registerAjaxStuff() {
ajaxEngine.registerRequest( 'getWeatherInfo', 'getWeatherInfoHTML.do' );
//some other stuff here I deleted
//registers HTML and javascript containers//this here is our GET variable
$('zip').onkeydown = handleEnterKey.bindAsEventListener($('zip'));}
getWeatherInfoHTML.do is a file requested, through code in rico.js, to a server handler (they are using a Java servlet). This is typically how you would implement a service (i.e. dynamically).
I haven't looked at the rico code, but I can tell getWeatherInfoHTML.do is just a url, because using it as such calls a revealing error. We need arguments to call the URL, else it returns nothing useful. Notice in the code above the zip variable? That's the argument we need to call. Try it out.
So, to get the example to work, we need only modify the URL handling for ajaxEngine.sendRequest(). This is done in ajaxEngine.registerRequest(). Things would work fine, but we still have to cross-domain limitation.
The PDF documentation is helpful. I should have read that first ;).

How do I modify the URL handling for the ajaxEngine.sendRequest(). I can get the page to show the input box and put in a zip, put nothign shows after that. It is not showing the weather for the zip I put in, just a blank area where the input field and button used to be. I don't know anything about javascript so this is all new to me.

I don't think you understand how the library or XMLHTTPRequest works. I answered your question above. But you will still run into a snag, even if you change the request URL.
"...XMLHTTPRequest only works within one domain.". See my previous posts for why.
"The example requires some server-side functionality to work." Again, see the previous post. Finally, read the openrico.org documentation to see how the library works. You have all the code in front of you except for the Java request handler.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |