diff --git a/index.html b/index.html index 03ad9a5d4..1cd411c53 100755 --- a/index.html +++ b/index.html @@ -90,21 +90,18 @@ map.controller.setState(new iD.controller.shape.NoSelection()); }); + function grid(resp) { + map.setCentre({ + lon: resp.results[0][0].lon, + lat: resp.results[0][0].lat + }); + } d3.select('#geocode-form').on('submit', function() { d3.event.preventDefault(); var val = d3.select('#geocode-location').node().value; - $.ajax({ - url: 'http://api.tiles.mapbox.com/v3/mapbox/geocode/' + - encodeURIComponent(val) + '.jsonp', - dataType: 'jsonp', - jsonpCallback: 'grid', - success: function(resp) { - map.setCentre({ - lon: resp.results[0][0].lon, - lat: resp.results[0][0].lat - }); - } - }); + var scr = document.body.appendChild(document.createElement('script')); + scr.src = 'http://api.tiles.mapbox.com/v3/mapbox/geocode/' + + encodeURIComponent(val) + '.jsonp?callback=grid'; }); /* diff --git a/js/iD/actions/CreatePOIAction.js b/js/iD/actions/CreatePOIAction.js index a50a56cf1..805240509 100644 --- a/js/iD/actions/CreatePOIAction.js +++ b/js/iD/actions/CreatePOIAction.js @@ -28,7 +28,7 @@ define(['dojo/_base/declare', 'iD/actions/UndoableAction'], if (this.newNode === null) { this.newNode = this.connection.doCreateNode(this.tags, this.lat, this.lon, - _.bind(this.push, this)); + this.push.bind(this)); } this.connection.registerPOI(this.newNode); return true;