Dear colleagues:
I am working with a json string with the following format:
[{"id":"1","nombrelonlat":"A;28.00;-15.00"},
{"id":"","nombrelonlat":";28.20;-15.50"},
{"id":"2", "nombrelonlat":"b;28.01;-15.01"#"id":"3", "nombre":"c;28.05;-15.05"}]
from latitude longitude I write it in gmap map, all ok except I do not know how to start recursively.
I have the following code
$.ajax({
type: "GET",
url: 'http://www.grancanariamodacalida.es/json_tiendas.php',
async: false,
dataType: "json",
success: function (data) {
//alert(data);
$.each(data, function (key, registro) {
var id = "";
var nombre = "";
var lon ="";
var lat ="";
});
$.each(registro, function (campo, valor) {
//alert(campo + ": " + valor);
if (campo == "id") {
id = valor;
}
if (campo == "nombre") {
var punfisdata = valor;
//alert (punfisdata);
if (punfisdata = ""){
nombre= valor.split(";")[0];
//alert(cont1.valueOf());
lon = valor.split(";")[1];
//alert(cont2);
lat = valor.split(";")[2];
//alert(cont3);
}
});
But do not shoot me. As you can see some data come empty, others come with a record, others with two or more separated by #.
Any ideas on how to separate them correctly?
S @ | u2.