On Monday, November 21, 2011, emmexx <[email protected]> wrote: > I use a vector layer that gets data from the server in geojson format. > I create the layer like the following. > Up to now I used only 2 fixed params. Now I would like to use a third > one, dynamic. On the page there'll be a ckeck and I'd like the 3rd > parameter to send to the server also this one. > > var p3layer = new OpenLayers.Layer.Vector("mylayer", > { > strategies: [strategy1, strategy2], > protocol: new OpenLayers.Protocol.HTTP({ > url: path, > params: { > 'l1': 'myparameter', > 'id': 'another parameter', > 'adb': ??? > }, > format: new OpenLayers.Format.GeoJSON() > }), > and so on > > > I tried using a function like the following but it didn't work: > > function getadb() > { > return something; > } > > var p3layer = new OpenLayers.Layer.Vector("mylayer", > { > ... > params: { > 'l1': 'myparameter', > 'id': 'another parameter', > 'adb': getadb() > }, > > What is the correct way to get what I
You can do layer.protocol.params.adb = "value"; -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : [email protected] http://www.camptocamp.com
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
