Solved! Go to Solution.
var serviceLayersRequest = esri.request({ url: "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/layers", // change to your url content: { f: "json" }, handleAs: "json", callbackParamName: "callback" }); serviceLayersRequest.then( function(response) { console.log("Success: ", response.layers); console.log("Success: ", response.tables); }, function(error) { console.log("Error: ", error.message); });
var serviceLayersRequest = esri.request({ url: "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/layers", // change to your url content: { f: "json" }, handleAs: "json", callbackParamName: "callback" }); serviceLayersRequest.then( function(response) { console.log("Success: ", response.layers); console.log("Success: ", response.tables); }, function(error) { console.log("Error: ", error.message); });