开发者

Message: Invalid argument. Google maps

开发者 https://www.devze.com 2023-03-12 15:57 出处:网络
Trying to debug this Google maps error. Works in all tested browsers except IE. Sometimes markers s开发者_开发知识库how, sometimes they won\'t.

Trying to debug this Google maps error.

Works in all tested browsers except IE. Sometimes markers s开发者_开发知识库how, sometimes they won't.

http://www.ecompanies.nl/pilot/warenhuis/breda.html

Webpage error details Message: Invalid argument. Line: 27 Char: 56 Code: 0 URI: http://maps.gstatic.com/intl/nl_nl/mapfiles/api-3/5/6a/main.js


I had this problem, and for me, it turned out to be a conflict with a jquery ajax call on document.ready(). notable details:

  • was including this gstatic file ref'd above
  • was including jquery 1.6.4, in noConflict() mode
  • was including jquery UI 1.8.14
  • was executing an ajax call to populate a div (a cart widget, how many items, how much etc.), on document.ready()

to solve, i ended up with something like this:

// wrap ajax call in a function, then figure out if we execute it now, or delay.
var f = function(){
  $.getJSON('/ajax_handler/', function(data){/* do stuff */});
}
// check if google code is present (not sure how robust this is)
if(window['google']){ // We've got some Google, delay ajax call by 5s.
  setTimeout(f, 5000); // this was the lowest i could safely go, unfortunately.
} else { // No Google, do the ajax call immediately
  f();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消