I am new to javascript and I believe that syntax is the error. I have a problem with geoserver and Leaflet.
mylyr = L.tileLayer.wms('http://localhost:8080/geoserver/mydata/wms?', {layers: 'mydata:parcels'});
This works perfectly. But I need to get layers of a variable.
var mygeodata = "'mydata:" + "parcels'"
When I put this in my code, does not work:
mylyr = L.tileLayer.wms('http://localhost:8080/geoserver/mydata/wms?', {layers: mygeodata});
What can I do to work? Thanks in advance
You should probably not include quotes within your string:
var mygeodata = "mydata:" + "parcels" // Result: mygeodata = "mydata:parcels"
…instead of:
var mygeodata = "'mydata:" + "parcels'" // Result: mygeodata = "'mydata:parcels'"