1
I’m trying to return a value from one function to the other, get_Positions() has to receive the lat and lng from parseJson(data), it’s only returning Undefined. I want to receive these two values from within get_Positions().
get_Positions();
function get_Positions(){
$.ajax({
url: 'http://taxer-cc.umbler.net/read.php',
type: 'POST',
dataType: 'html',
data: 'value1=1'
})
.done(function(data) {
var lct = parseJson(data);
console.log(lct);
})
.fail(function(e) {
console.log("Error: "+e);
});
function parseJson(data){
$.each($.parseJSON(data), function (item, value) {
$.each(value, function (i, k) {
var location = function(){
lat = k.lat;
lng = k.lng;
return [lat,lng];
}
loc = location();
lat = loc[0];
lng = loc[1];
return [lat,lng];
});
});
}
}
Thank you, it worked properly!
– Daniel