I can't return a value from this AJAX request, I tried but I'm getting undefined
. Any one please help me on this
function coordinates(values){
var cords;
$.ajax({
url: 'https://geocoder.ls.hereapi.com/6.2/geocode.json',
type: 'GET',
dataType: 'jsonp',
jsonp: 'jsoncallback',
async: false,
data: {
searchtext: values,
gen: '9',
apiKey: 's_WF6U2g60ucHbmnYIyuieeUWnkT0jshGf4mD33kpwI'
},
success: function (data) {
var x = JSON.parse(JSON.stringify(data));
cords=[x.Response.View[0].Result[0].Location.DisplayPosition.Latitude, x.Response.View[0].Result[0].Location.DisplayPosition.Longitude];
}
});
return cords;
}