title: Google Maps v3 adding markers via jQuery $.ajax and json
body: <p>Im having problem's adding map markers to gmaps using jquery. Here is my code so far.</p>
  
  <p>Right now, the error I am getting is <code>Uncaught ReferenceError: GLatLng is not defined</code></p>
  
  <p>The map loads fine and the json data is being fetched and parsed properly... From what I can tell... ;)</p>
  
  <p><strong>Adding Map Pins/markers or w/e you call em...</strong></p>
  
  <pre><code>
  EventsModel.prototype.fetchMapPoints = function()
  {
      $.ajax({
          dataType: "json",
          url: '../../events/map',
          success: eventsV.writeMapPoints
      });
  }
  
  EventsView.prototype.writeMapPoints = function(Locations)
  {
      if (Locations.length&gt;0) { 
        for (i=0; i&lt;Locations.length; i++) { 
          var location = Locations[i]; 
          eventsV.addMapPin(location); 
        } 
        //zoomToBounds(); 
      }
  }
  
  EventsView.prototype.addMapPin = function(location)
  {
      var point = new GLatLng(location.lat, location.lng); 
      var marker = new GMarker(point); 
      map.addOverlay(marker); 
      bounds.extend(marker.getPoint()); 
      $(&quot;&lt;li /&gt;&quot;)
      .html(location.name) 
      .click(function(){ 
        showMessage(marker, location.name); 
      }) 
      .appendTo(&quot;#list&quot;); 
      GEvent.addListener(marker,&quot;click&quot;, function(){ 
      showMessage(this); 
      }); 
  
  }
  </code></pre>
  
  <p><strong>Map Initialization</strong></p>
  
  <pre><code>
  EventsModel.prototype.fetchGmapScript = function()
  {
      var script = document.createElement(&quot;script&quot;);
      script.type = &quot;text/javascript&quot;;
      script.src = &quot;http://maps.google.com/maps/api/js?sensor=false&amp;callback=eventsV.initializeMap&quot;;
      document.body.appendChild(script);
  }
  
  EventsView.prototype.initializeMap = function()
  {
      var myLatlng = new google.maps.LatLng(coords.lat, coords.long);
      var myOptions = {
      zoom: 13,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      map = new google.maps.Map(document.getElementById(&quot;Map&quot;), myOptions);
  }
  </code></pre>
  
  <p><strong>Here is what the json data looks like</strong></p>
  
  <pre><code>
  [{"Event":"c16a5320fa475530d9583c34fd356ef5","lat":"37.8966942","lng":"-122.0599376","Image":"321752348.png","name":"Winning apple store","Description":""},{"Event":"b6d767d2f8ed5d21a44b0e5886680cb9","lat":"37.8995050","lng":"-122.0619770","Image":"","name":"Koreana Kitchen","Description":"Peter isn't invited!"}]
  </code></pre>