在 AJAX 面板中时 Bing 地图 v7 出现问题
我在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑是因为在实际显示地图尝试使用的 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