I am utilizing a reverse geolocation technique using MapQuest that is structured as follows:
function fieldVia_changed(a)
{
if (document.getElementsByName("via"+a)[0].value.trim().length!=0)
{
var via = document.getElementsByName("via"+a)[0].value ;
var strV = via.replace(/ |,/g, "+");
var s = document.createElement('script');
s.src = 'http://open.mapquestapi.com/nominatim/v1/search?q='+strV+'&json_callback=cbv&format=json&polygon=1&addressdetails=1';
document.getElementsByTagName('head')[0].appendChild(s);
}
}
The data retrieved from the request is handled by the cbv function which takes in an argument.
function cbv(json)
{
v_lat[0] = json[0].lat;
v_lng[0] = json[0].lon;
}
However, I require the ability to pass an additional parameter to the cbv function from the fieldVia_changed function in order to properly process the information. The definition of the cbv function would need to be adjusted to include another argument, such as function cbv(json,a). Despite my thorough search efforts, I have been unable to find a solution for this issue. Is it feasible to achieve?