alert a message in case network dies or so on editstops

This commit is contained in:
Sanj 2012-02-28 15:31:38 +05:30
parent ba4f482a2b
commit feadf4b110
2 changed files with 5 additions and 2 deletions

View File

@ -123,7 +123,7 @@ class Stop(models.Model):
} }
def get_geojson(self, srid=4326): def get_geojson(self, srid=4326):
print srid # print srid
if self.point is not None: if self.point is not None:
geom = json.loads(self.point.transform(srid, True).geojson) geom = json.loads(self.point.transform(srid, True).geojson)
else: else:

View File

@ -223,12 +223,15 @@ var API_BASE = "/1.0/",
var geojsonString = JSON.stringify(geojson); var geojsonString = JSON.stringify(geojson);
//console.log(geojsonString); //console.log(geojsonString);
var url = API_BASE + "stop/" + stop.slug + "?srid=3857"; var url = API_BASE + "stop/" + stop.slug + "?srid=3857";
$.post(url, {'geojson': geojsonString}, function(response) { var $postXHR = $.post(url, {'geojson': geojsonString}, function(response) {
if (response.errors) { if (response.errors) {
alert("error saving"); alert("error saving");
} }
//console.log(response); //console.log(response);
}, "json"); }, "json");
$postXHR.fail(function(e) {
alert('failed ' + JSON.stringify(e));
});
}); });
return $div; return $div;
} }