Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Failed to load resource: Origin http://localhost:8383 is not allowed by Access-Control-Allow-Origin. at http://HOST_IP:8082/geoserver/test/wfs
- XMLHttpRequest cannot load http://HOST_IP:8082/geoserver/test/wfs. Origin http://localhost:8383 is not allowed by Access-Control-Allow-Origin. (13:29:51:925 | error, javascript) at resources/webappv1.html
- var xmlData =
- +'< wfs:Transactionn'
- + 'service = "WFS"n'
- + 'version = "1.0.0"n'
- + 'xmlns:wfs = "http://www.opengis.net/wfs"n'
- + 'xmlns:gml = "http://www.opengis.net/gml"n'
- + 'xmlns:test = "http://test.org"n'
- + 'xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" n'
- + 'xsi:schemaLocation = "http://www.opengis.net/wfs n'
- + 'http://HOST_IP:8082/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd n'
- + 'http://test.org/ n'
- + 'http://HOST_IP:8082/geoserver/test/wfs/DescribeFeatureType?
- typename=test:user_poi">n'
- + '< wfs:Insert >n'
- + '< test:user_poi >n'
- + '< test:gid >' + gid + '< /test:gid>n'
- + '< test:id >' + id + '< /test:id>n'
- + '< test:tid >' + id + '< /test:tid>n'
- + '< test:auid >' + auid + '< /test:auid>n'
- + '< test:mdid >' + mdid + '< /test:mdid>n'
- + '< test:text >' + text + '< /test:text>n'
- + '< test:the_geom >n'
- + '< gml:Point srsDimension = "2" srsName = "urn:x-ogc:def:crs:EPSG:3857" n'
- + '< gml:coordinates decimal = "." cs = "," ts = " " >' + lat + ',' + long + '< /gml:coordinates>n'
- + '< /gml:Point>n'
- + '< /test:the_geom>n'
- + '< /test:user_poi>n'
- + '< /wfs:Insert>n'
- + '< /wfs:Transaction>n';
- $.ajax({
- type: "POST",
- crossDomain: true,
- url: wfsurl,
- dataType: "xml",
- contentType: "text/xml",
- data: xmlData,
- xhrFields: {
- withCredentials: true
- },
- username: 'user',
- password: 'user',
- success: function(data, textStatus, request) {
- alert(request.getResponseHeader('some_header'));
- },
- error: function(request, textStatus, errorThrown) {
- alert(request.getResponseHeader('some_header'));
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement