I have written the following code to read a JSON document from an external URL. This worked fine when the URL was the following:
http://localhost/EWSimpleWebAPI/odata/Users?
But NOT when I modified the URL as the following:
http://localhost/EWSimpleWebAPI/odata/Users?$filter=USER_NAME%20eq%20%27corpnet\anuwlk%27&$select=PROFILE
Javascript
var xmlhttp = new XMLHttpRequest();
var url = "http://localhost/EWSimpleWebAPI/odata/Users?$filter=USER_NAME%20eq%20%27corpnet\anuwlk%27&$select=PROFILE";
xmlhttp.open("GET", url, true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
myFunction(xmlhttp.responseText);
errorAlert("Status OKAY");
} else{
errorAlert("Status Not OKAY")
}
}
xmlhttp.send();
I'm retrieving the JSON Document thru a Web API using OData. OData accepts parameters in the URL and it worked fine in POSTMAN. I'm developing a Google Chrome extension and I'm not sure if it supports this URL with Parameters.