AJAX revisited

Christoph Baudson christoph.baudson at ccgis.de
Wed Nov 29 06:14:59 EST 2006


Hi there,

in a recent experiment with jQuery I added some AJAX-functionality to 
Mapbender (see http://wms1.ccgis.de/mapbender_dev/, GUI 
gui_digitize_modular).

When a geometry is sent to Geoserver I send the request via AJAX and not 
via a frame:

parent.mb_ajax_get('../extensions/geom2wfst2.php', 
{filter:str,url:myconf['wfs_transaction']}, 
function(xml,status){wfsSubWrite(m,type,status);});

'geom2wfst2.php' sends the geometry to Geoserver; the request is a 
combination of the parameters 'url' and 'filter'.

The new thing is the function wfsSubWrite: it's a callback function, 
invoked when the WFS request is finished. It refreshes the mapframe 
after a geometry has been saved/deleted/updated. There are no more 
synchronization problems.

Another advantage is, that geom2wfst2.php no longer has to handle the 
xml result from Geoserver. It's simply returned to the callback function by

header('Content-type: text/xml');
echo $data;

The callback function can now check if any errors occured (still on my 
to do list). This is the modular approach that we are after.

Cheers,

Christoph




More information about the Mapbender_dev mailing list