Changeset 45


Ignore:
Timestamp:
Oct 15, 2006, 4:44:10 PM (13 years ago)
Author:
David Sheldon
Message:

output javascript method calls, a little less verbose

File:
1 edited

Legend:

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

    r39 r45  
    6666    if ($sth->execute($cgi->param('mineasting'), $cgi->param('maxeasting'), $cgi->param('minnorthing'), $cgi->param('maxnorthing'))) {
    6767        my $hr = $sth->fetchall_hashref('postcode');
    68         print "Content-type: text/x-json\n\n";
    69         print objToJson($hr) . "\n";
     68        print "Content-type: text/javascript\n\n";
     69
     70        foreach my $key (keys %$hr) {
     71            my $hash = $$hr{$key};
     72            print "addMarker('$$hash{postcode}', $$hash{easting}, $$hash{northing});\n";
     73        }
     74        #print objToJson($hr) . "\n";
    7075    } else {
    7176        print_err("Database error retrieving data");
     
    8792sub setup_dbh {
    8893    # $dbh is global
    89     return $dbh = DBI->connect_cached("dbi:Pg:dbname=npemaps","npemaps","");
     94    return $dbh = DBI->connect_cached("dbi:Pg:dbname=npemaps;host=127.0.0.1","npemaps","npemaps");
    9095}
Note: See TracChangeset for help on using the changeset viewer.