AnsweredAssumed Answered

How do a returned layer number to my web service url?

Question asked by csergent08 on May 12, 2015
Latest reply on May 13, 2015 by csergent08

I have the following code and the script evaluate which layer is Support. In this case it is one. I would like to assign that value through JavaScript as opposed to hard coding it. jsonValue does give me what I want, but I can't figure out how to assign the number to the supportLayerUrl:


 var jsonValue;
    // Get the id of a layer
    var requestHandle = esriRequest({
        url: "",
        content: {
            f: 'json'
        handleAs: "json"

    requestHandle.then(function (lyrJSON, io) {
        for (var i = 0; i < lyrJSON.layers.length; i++) {
            if (lyrJSON.layers[i].name = "Support") {
                jsonValue = lyrJSON.layers[i].id;

        return jsonValue;

    function checkValue() {

    // app configuration  
    var config = {

        mapOptions: {
            showAttribution: false,
            sliderStyle: "small",
            extent: initialExtent,
            logo: false,
            sliderPosition: "bottom-right"

        signLayerUrl: "",
        supportLayerUrl: "" 




I would like for my supportLayerUrl be something like this:

supportLayerUrl: "" + jsonValue


But I get jsonValue not defined. Any ideas?