Monday, June 30, 2008

AJAX was here

I was able to create simple AJAX code for the most frequently used example to spice up your information website: stock quote and weather information. Where do you get stock quote and weather information? There are PLENTY of sites. Yahoo!Finance is a popular place for stock, and the national weather service give you the info.

Old school HTML will simply provide links to information on those service providing sites. Nowadays people demand more! How about those info right on your site? This is nothing new. People have been doing that for YEARS. Now I am asked to put this in the company's intranet site.

Just how do you get information from another site into your site? One way is AJAX. Basically we quietly make a call to service providers and they will send us information, in XML, or comma-delimited, or whatever, and the event handler will quietly handle the response back from the service provider. (That's the first A, which stands for Asynchronous, in AJAX). The J is simply Javascript, and the next A is merely the conjunction "And". The X is everybody's favorite XML.

The task now becomes: just what is the URL to the service provider? What type of format am I getting back? How do I parse the results?

Hopefully you will find what you need from your provider.

This link gave me some great examples to get to weather service.

This link provides the nuts and bolts I needed to get stock information! Hmm, how come I can't find field description from the CSV in yahoo!finance? I pulled all that JSF stuff out and just do simple HTML.

No comments: