Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created May 8, 2013 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/5542207 to your computer and use it in GitHub Desktop.
Save tmcw/5542207 to your computer and use it in GitHub Desktop.
var map = L.mapbox.map('map', 'nico-suonper.map-6gwti04q').setView([-34.92, -57.95], 13);
var features = [];
$.ajax({
type: 'get',
dataType: 'json',
url: 'ajax.php',
data: {valor: valor1},
success: function(json) {
for (j = 0; j < json.length; j++) {
y = json[j].posy;
x = json[j].posx;
color = '#F70707';
features.push({
type: "Feature",
geometry: {
type: "Point",
coordinates: [y, x]
},
properties: {
title: 'DATOS',
description:
datos,
"marker-color": "#5dbfe1",
"marker-size": "small",
"marker-symbol": "star"
}
});
}
secondFile();
}
});
function secondFile() {
$.ajax({
type: 'get',
dataType: 'json',
url: 'ajax2.php',
data: {valor: valor2},
success: function(json){
for (j = 0; j < json.length; j++) {
y = json[j].posy;
x = json[j].posx;
color = '#F70707';
features.push({
type: "Feature",
geometry: {
type: "Point",
coordinates: [y, x]
},
properties: {
title: 'DATOS',
description:
data,
"marker-color": "#5dbfe1",
"marker-size": "small",
"marker-symbol": "star"
}
});
}
map.markerLayer.setGeoJSON({
type: "FeatureCollection",
features: features
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment