<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WFS Ajax Post </title>
<script type="text/javascript">
var reqXML;
function LoadXMLDoc(url){
if (window.XMLHttpRequest){
reqXML = new XMLHttpRequest();
}
else if(window.ActiveXObject){
reqXML = new ActiveXObject("Microsoft.XMLHTTP");
}
if(reqXML){
document.getElementById("spanOut").innerHTML = "Sending Information...";
reqXML.open("POST", url, true);
reqXML.onreadystatechange = BuildXMLResults;
reqXML.setRequestHeader("Content-Type", "application/xml");
//var strName = encodeURI(document.Form1.txtName.value);
//var strMess = encodeURI(document.Form1.txtMess.value);
var strMess = document.Form1.txtMess.value;
var xmlBody = strMess ;
reqXML.send( xmlBody);
}
else{
alert("Your browser does not support Ajax");
}
}
function BuildXMLResults(){
if(reqXML.readyState == 4){
if(reqXML.status == 200){
var strText = reqXML.responseText;
var regex1 = /</g;
var regex2 = />/g;
strText = strText.replace( regex1, "<");
strText = strText.replace( regex2, ">");
//alert(strText);
document.getElementById("spanOut").innerHTML = strText;
}
else{
alert("There was a problem retrieving the XML data:\n" + reqXML.statusText);
}
}
}
</script>
</HEAD>
<body>
<h1>Get Feature using Ajax Post</h1>
<form id="Form1" name="Form1" method="post" onsubmit="LoadXMLDoc('http://webservices.ionicsoft.com/unData/wfs/UN'); return false;">
<textarea name="txtMess" rows="15" cols="80">
<wfs:GetFeature service="WFS" version="1.0.0"
outputFormat="GML2"
xmlns:topp="http://www.openplans.org/topp"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:unwfs="http://www.ionicsoft.com/wfs"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
<wfs:Query typeName="unwfs:AIR_POINT">
</wfs:Query>
</wfs:GetFeature>
</textarea><br>
<input type="submit" name="btnSubmit" value="Submit"><br/>
<span id="spanOut"></span>
</form>
</body>
</HTML>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment