Consider the following script (besides). If I try to create a variable map
before adding the Google Maps link, I get a reference error: google is not defined
link before the error script Is it possible to eliminate this error without taking it? Even if the answer is "no", then I appreciate the explanation about it.
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" & gt; & Lt; Title & gt; Trial & lt; / Title & gt; & Lt; Link href = "// ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/ui-lightness/jquery-ui.css" type = "text / css" rel = "stylesheet" /> & Lt; Style type = "text / css" & gt; & Lt; / Style & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.js" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.js" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt ;! - & lt; Script type = "text / javascript" src = "// maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places" & gt; & Lt; / Script & gt; - & gt; & Lt; Script & gt; (Function ($) {var map = new google.maps.LatLng (47.64864, -122.348 927);} (jQuery)); & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "// maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></ script & Gt; & Lt; / Body & gt; & Lt; / Html & gt;
define which you are trying to call a method named within the Google namespace In your commented script, the solution for this is to use jQuery. When your page is loaded, there is a method to execute your code (including your script, at the bottom of the page). Wrap your work within this and you would love to go:
$ (document) .ready (function () {var map = new google.maps.LatLng (47.64864, -122.348 927); }); For more information on preparing
you can always see the useful jQuery API:
No comments:
Post a Comment