在 AJAX 面板中时 Bing 地图 v7 出现问题

发布于 2024-11-09 00:01:07 字数 962 浏览 0 评论 0原文

我在使用 Bing 地图版本 7 时遇到了一个奇怪的问题。

我有一个页面通过 ajax 将地图调用为新的 html 页面,但这不起作用!如果我将使用 AJAX 返回的页面中的标记复制到新的虚拟页面中,并在浏览器中查看地图是否有效......!?

有什么想法为什么会这样吗?调用 AJAX 时是否有特定的方式来使用地图?

一如既往,非常感谢,祝一切顺利,

JavaScript 调用地图面板

function ShowMap(establishmentCode) {
    $("#Map").hide();
    var element = $("#viewMap" + establishmentCode);
    var url = Url.replace("Show", "GetHotelMap");
    var builder = new AjaxDataBuilder();
    builder.Add("establishmentCode", establishmentCode);

    var successCallback = function(html) {
    globalElement = element;
    globalHMTL = html;
    globalHotelName = establishmentCode;
    DisplayHotelMap();
}


var errorCallback = function() { alert("Error"); }
var timeoutInMilliseconds = 30000;

var command = new AjaxPostCommand
(
    url,
    builder,
    successCallback,
    errorCallback,
    timeoutInMilliseconds
);

CommandInvoker.getInstance().QueueCommand(command);

}

I have a weird problem with Bing Maps version 7.

I have a page that calls the map as a new html page via ajax which doesnt work! If I copy the markup from the page that gets returned using AJAX into a new dummy page and view that within a browser the map works..!?

Any ideas why this would be? Is there a particular way to use the map when calling it AJAX?

Many thanks as always, all the best,

JavaScript to call the map panel

function ShowMap(establishmentCode) {
    $("#Map").hide();
    var element = $("#viewMap" + establishmentCode);
    var url = Url.replace("Show", "GetHotelMap");
    var builder = new AjaxDataBuilder();
    builder.Add("establishmentCode", establishmentCode);

    var successCallback = function(html) {
    globalElement = element;
    globalHMTL = html;
    globalHotelName = establishmentCode;
    DisplayHotelMap();
}


var errorCallback = function() { alert("Error"); }
var timeoutInMilliseconds = 30000;

var command = new AjaxPostCommand
(
    url,
    builder,
    successCallback,
    errorCallback,
    timeoutInMilliseconds
);

CommandInvoker.getInstance().QueueCommand(command);

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

计㈡愣 2024-11-16 00:01:07

我怀疑是因为在实际显示地图尝试使用的 div 之前就调用了尝试加载地图的代码?在使用 v6.3 控件的类似情况下,这肯定是一个问题

I suspect its because the code that tries to load the map is being called before you actually display the div that the map is trying to use? this certainly was a problem in similar situations with the v6.3 control

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文