Wijmo User Guide > Data > Data Concepts > Remote Data > General Web Service |
When you use the wijmo.data module with a general web service, you need to use the wijmo.data.AjaxDataView class to set the service URL. To use a general RESTful web service, use a script like the following.
RESTful Script |
Copy Code
|
---|---|
function ViewModel(sessionId) { var productView = new wijmo.data.AjaxDataView("http://demo.componentone.com/aspnet/NorthwindAPI/api/read/Product", { pageSize: 10, ajax: { crossOrigin: true } }); |
In this sample, we set the type of data view we want to use, the service URL, and the pageSize.
Note that we also must specify the sessionID, which do do not need to supply with OData.
We also set an ajax setting, crossOrigin, to true. This allows you to make cross domain requests from your server. You must always set crossOrigin to true when using an AJAX web service in order to make cross domain requests. You can specify it using either the crossOrigin property or the dataType property.
For a full sample demonstrating a general RESTful web service, please see the How To topic Use a RESTful Web Service.