Passing address to Google Maps on page load

前端 未结 3 1742
清酒与你
清酒与你 2021-01-24 15:48

Having some problems initialising a google map using geocoding. First issue is with any commas being used in the $gmap string, second issue is with getting a \"gmap_initialize i

相关标签:
3条回答
  • 2021-01-24 16:35

    Did you look at the output of your script?!

    My guess is it looks something like:

    geocoder.geocode( { 'address': Prague, Czech Republic}, function(results, status) {

    In your PHP script, you probably actually want something like:

    geocoder.geocode( { 'address': '<?php echo $gmap; ?>'}, function(results, status) {

    and you'll probably want to escape single quotes out of the $gmap variable.

    0 讨论(0)
  • 2021-01-24 16:39

    This looks like a JavaScript Error. Saying that this function (which looks right) is not defined. Maybe the call to gmap_initialize happens before this definition?

    0 讨论(0)
  • 2021-01-24 16:43

    Usually this error comes with JavaScript when something else on the page is not quite right, such as a single missing close tag...

    Have you validated the code with W3C?

    0 讨论(0)
提交回复
热议问题