Ignore:
Timestamp:
Oct 19, 2006, 9:29:13 PM (15 years ago)
Author:
David Sheldon
Message:

Reuse the marker DIVs in the hope of making it faster, and show a message whilst they load (an animated spinner didn't help as the speed limit is in the client).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/cgi/get-postcodes.fcgi

    r82 r84  
    7373    }
    7474
    75     my $sth = $dbh->prepare("SELECT outward || ' ' || inward AS postcode, easting, northing FROM postcodes WHERE easting BETWEEN ? AND ? AND northing BETWEEN ? AND ?");
     75    my $sth = $dbh->prepare("SELECT outward || ' ' || inward AS postcode, easting, northing,id FROM postcodes WHERE easting BETWEEN ? AND ? AND northing BETWEEN ? AND ?");
     76   
    7677    if ($sth->execute($cgi->param('mineasting'), $cgi->param('maxeasting'), $cgi->param('minnorthing'), $cgi->param('maxnorthing'))) {
    7778        my $hr = $sth->fetchall_hashref('postcode');
     
    8081        foreach my $key (keys %$hr) {
    8182            my $hash = $$hr{$key};
    82             print "addMarker('$$hash{postcode}', $$hash{easting}, $$hash{northing});\n";
     83            print "addMarker('$$hash{postcode}', $$hash{easting}, $$hash{northing}, $$hash{id});\n";
    8384        }
     85        print "completeMarkers();\n";
    8486    } else {
    8587        print_internal_err("Database error retrieving data");
     
    9294
    9395# Helper routines
    94 sub print_err($) {
     96sub print_err {
    9597    my $err = shift;
    9698    print header("text/plain", "400 $err");
     
    98100}
    99101
    100 sub print_internal_err($) {
     102sub print_internal_err {
    101103    my $err = shift;
    102104    print header("text/plain", "500 $err");
Note: See TracChangeset for help on using the changeset viewer.