I would like to parse my variable "valueStations2" into a xml string.
Instead of a static sos:FeatureOfInterestId value (here e.g. "stationname") I would like to have a dynamic parsed from javascript.
I tried setting my variable in quotes like "valueStation2" for "stationname"
but xml does not except.
I would like to know how to add a variable to xml. Any suggestions?
var valueStation2;
var xml = "<?xml version='1.0' encoding='UTF-8'?>
<sos:GetFeatureOfInterestTime
xmlns:sos='http://www.opengis.net/sos/1.0'
service='SOS' version='1.0.0'
xmlns:ows='http://www.opengeospatial.net/ows'>
<sos:FeatureOfInterestId>stationname</sos:FeatureOfInterestId>
</sos:GetFeatureOfInterestTime>";
// create handler
var request = OpenLayers.Request.POST({
url: "http://139.17.3.301:8080/mydata/sos",
data: xml,
callback: handler
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…