jQuery Example of using the CDAS Web Services

This page demonstrates using jQuery .ajax() to access the CDAS Web Services. This page is not intended to be an end-user application. It is intended to show web client developers how they could use the CDAS web services in their own JavaScript clients.

There's an equivalent Node.js example here.

Data Request

Below is an example CDAS web service data request. The CdfFormat is specified as ICDFML. This will result in the data being returned inside the HTTP response in a JSON representation of CDFML. An XML (instead of JSON) response is returned if the HTTP Accept header specifies application/xml. If the CdfFormat is any other value (e.g., CDFML, Binary, etc.), the HTTP response contains a URL to the data file requiring a second request to get the actual data. The ICDFML format is limited in how much data it will return. Large data requests should use one of the other CdfFormat values.

JavaScript Code

The example JavaScript code below sends the above CdfRequest to the CDAS REST Web Services.

Click this button to send the CdfRequest to CDAS.

Data Response

Below is the response to the above CdfRequest. Note that it contains actual data values for the specified dataset, time range, and variable.