Please read http://aspalliance.com/713
to find the need of consuming webservices from a HTML page. The methodology
explained in the above article works only in IE. By February 2011 IE accounts
for around 44% while Firefox enjoys a share of 29%.Chrome is in the third place
with around 14%.So there is a clear need for a cross browser solution. Here
comes the JQUERY…(If you are new to JQUERY, please see the reference section for its official website and
tutorials)
We use JQUERY cross browser capabilities to achieve our
objective. In the first part we will explore the consumption of XML webservices
and then we will look into JSON webservices in the second part.
Download
Download JQUERY from this link http://code.jquery.com/jquery-1.4.2.min.js
Note: I have not tested the code with
new versions of JQUERY yet. You can download new versions and experiment. I
have used minified version of JQERY for faster execution, but it is not very
user-friendly to read. If you want to read the code inside JQUERY, please
download uncompressed version. In your code you can refer to uncompressed version
as well, but obviously it takes bit more time to execute.
All the versions are available at http://docs.jquery.com/Downloading_jQuery
Caution
This article deals with the scenario where both client
(HTML page) and webservices reside on the same server. This may work with the
webservices on different servers, if they allow cross-domain requests.