refs #5 change the way to parse XML to avoid browser warning/error

merge-requests/1/head
Julien Veyssier 2016-12-06 13:35:03 +01:00
parent 2b4cdf3dcd
commit 7d3b29191f
1 changed files with 4 additions and 3 deletions

View File

@ -396,8 +396,9 @@ function drawLine(latlngs, name, desc, cmt){
// parse gpx xml text to draw it on the map // parse gpx xml text to draw it on the map
function parseGpx(xml){ function parseGpx(xml){
var dom = $.parseXML(xml); //var dom = $.parseXML(xml);
$(dom).find('wpt').each(function(){ var dom = $(xml);
dom.find('wpt').each(function(){
var lat = $(this).attr('lat'); var lat = $(this).attr('lat');
var lon = $(this).attr('lon'); var lon = $(this).attr('lon');
var name = $(this).find('name').text(); var name = $(this).find('name').text();
@ -411,7 +412,7 @@ function parseGpx(xml){
drawMarker([lat, lon], name, desc, cmt); drawMarker([lat, lon], name, desc, cmt);
} }
}); });
$(dom).find('trk').each(function(){ dom.find('trk').each(function(){
var latlngs = []; var latlngs = [];
var name = $(this).find('name').text(); var name = $(this).find('name').text();
var cmt = $(this).find('cmt').text(); var cmt = $(this).find('cmt').text();