January 2018
Intermediate to advanced
418 pages
8h 20m
English
XMLHttpRequest (XHR) is a native object supported by all browsers, which enables AJAX techniques for making web pages dynamic.
We will look at a very simple example that uses a Web API and XMLHttpRequest object.
The following is the Web API code that will fetch all the opportunities:
var req = new XMLHttpRequest(); req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/opportunities()", true); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("Prefer", "odata.include-annotations="*"");Read now
Unlock full access