次のように、コールバック関数を使用して bing ジオコード リクエストを作成する方法を知っています。
function MakeGeocodeRequest(credentials)
{
var geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations/" + document.getElementById('txtQuery').value + "?output=json&jsonp=GeocodeCallback&key=" + credentials;
CallRestService(geocodeRequest);
}
function CallRestService(request)
{
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", request);
document.body.appendChild(script);
}
function GeocodeCallback(result)
{
// Do something with the result
}
(msdn Maps AJAX Control 7.0 ISDK からコピー)
Bing Map 6.2 バージョンでは、次のコードを使用してそのような要求を行う機会がありました。
map.Find(null, tempDest, null, null, null, null, null, null, null, null,
function (a, b, c, d, e) {
...
});
すべての変数が定義され、すぐに使用できるため、非常に便利でしたが、新しいバージョンではすべての変数が未定義であり、それらをグローバルにしたくないので、そのようなコールバックなしでリクエストを行う方法を知っていますか?