[mapguide-users] Mapguide 3 and jQuery - First ajax request returns empty json

Greg gbneff at cid.utah.gov
Thu Jan 21 09:35:09 PST 2016


Mapguide 3.0
OpenLayers 3.12
jQuery 2.2.0
Windows 7 64bit

I have a strange issue that maybe someone can help with.  When sending a
QUERYMAPFEATURES request to the Mapguide server using the code below,
getJSON always reports success.  On the first request, however, the data is
empty.  All subsequent requests, even for the exact same selection are fine
and the data is as expected.  If the browser is refreshed and a new session
created, the data from the first request is again empty.  Any thoughts?

        wktFormat = new ol.format.WKT();
        function sendSelectionQuery(geom, layers) {
            var reqQueryFeatures = 3; //Attributes
            var wkt = wktFormat.writeGeometry(geom);
            $.getJSON(mapAgentUrl, {
                "OPERATION": "QUERYMAPFEATURES",
                "VERSION": "2.6.0",
                "PERSIST": "1",
                "MAPNAME": mapName,
                "SESSION": sessionId,
                "LAYERNAMES": layers,
                "GEOMETRY": wkt,
                "SELECTIONVARIANT": "INTERSECTS",
                "SELECTIONCOLOR": "0xFF000000",
                "SELECTIONFORMAT": "PNG8",
                "MAXFEATURES": "-1",
                "REQUESTDATA": reqQueryFeatures,
                "FORMAT": "application/json"
            }, function (data, textStatus, jqXHR) {
                processQueryResult(data);
            })
            .fail(function (jqXHR, textStatus, errorThrown) {
                $("#error").html(jqXHR.responseText);
            });
        }



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapguide-3-and-jQuery-First-ajax-request-returns-empty-json-tp5246579.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list