Request data from a remote server

This device does not support 3D.

View the system requirements for more information.

This sample shows how retrieve data from a remote server with some basic options.

The first thing you want to do is define the options for your request.

var options = {
  // These properties will be appended to the request URL in the following format:
  // <url>?f=json
  query: {
    f: 'json'
  },
  // Determine the format you want to read the response as.
  // Default type is 'json'. Other values are 'xml', 'text', 'blob', 'arraybuffer', 'document'.
  responseType: 'json'
};

The response object will consist of the properties data, requestOptions and url. You can handle the response as needed.

// The URL is the first argument, you can also pass the options as the second argument.
esriRequest(url, options).then(function(response) {
  // In this case, we simply print out the response to the page.
  var responseJSON = JSON.stringify(response, null, 2);
  resultsDiv.innerHTML = responseJSON;
});

Sample search results

TitleSample

There were no match results from your search criteria.