Example: Listing Selected Parcels (AJAX Viewer only)

To simplify the page in Example: Listing Selected Parcels (AJAX or DWF Viewer) so it runs in the AJAX Viewer only, replace the section of code that reads the selection data from the HTTP POST parameter:

    if (isset($_POST['SELECTION']) && $_POST['SELECTION'] != '')

    {

      $selection = new MgSelection($map, $_POST['SELECTION']);

      $layers = $selection->GetLayers();

    }

    else

    $layers = 0;

with the following, which retrieves the selection from the run-time map state:

    // ---------------------------------------------------------

    // Use the following code for AJAX Viewers only.

    // This does not require passing selection data via HTTP POST.

    //

    $selection = new MgSelection($map);

    $selection->Open($resourceService, $mapName);

    $layers = $selection->GetLayers();

There is no need to create a JavaScript function to call this page using the Submit() method of the formFrame. It can be run directly as a link from the calling page, passing just the SESSION and MAPNAME.