Below are the examples of Synchronous and Asynchronous XMLHttpRequest. Asynchronous request var req = new XMLHttpRequest(); req.open(requestType, serverURL + "/api/data/v8.2/" + query, false); 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=\"*\""); req.onreadystatechange = function () { if (this.readyState == 4 /* complete */) { req.onreadystatechange = null; if (this.status === 200) { var data = JSON.parse(this.response); fnSuccessCallback(data); } else { var error = JSON.parse(this.response).error; ...
Everything about Microsoft Dynamics 365 and Power Platform