title: Uncaught TypeError: Cannot read property 'Name' of undefined
body: <p><br>
  I'm developing a web page that display open street map and gets data from SQL server database by long and lat coordinates
  i use asp.net mvc    and give me this wrong<br>
  <br/>
  <b>Uncaught TypeError: Cannot read property 'Name' of undefined  </b> 
  <br/>
    where i bind data from database by javascript </p>
  
  <p><br>
  <b>Model</b><br>
  this model data i create  GetMap() that return data from database by Json function </p>
  
  <pre><code>  [HttpPost]
          public JsonResult GetMap()
          {
              var data1 =(from p in db.Map
                      select new
                      {
                          Name = p.Name,
                          Latitude = p.Latitude,
                          Logitude = p.Logitude,
                          Location = p.Location,
                          Description = p.Description,
                          Id = p.Id
                      }).ToList().Select(res =&gt; new Map
                      {
                          Name = res.Name,
                          Latitude = res.Latitude,
                          Logitude = res.Logitude,
                          Location = res.Location,
                          Description = res.Description,
                          Id = res.Id
  
  
                      });
              return Json(data1, JsonRequestBehavior.AllowGet);
          } 
  &lt;/pre&gt; 
  </code></pre>
  
  <p><b>view file</b><br>
  view file that display map and return data by Json function</p>
  
  <pre><code>    &lt;div id="mapid" style="height:600px"&gt;&lt;/div&gt;
      &lt;script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"&gt;&lt;/script&gt; 
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          $(document).ready(function () {
  
          var map = L.map('mapid').setView([31.291340, 34.244190], 13);
  
          L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
              attribution: '&amp;copy; &lt;a href="http://osm.org/copyright"&gt;OpenStreetMap&lt;/a&gt; contributors'
          }).addTo(map);
  
  
  
  
  
              $.ajax({
                  type: "POST",
                  url: '/Maps/GetMap',
                  success: function (data) {
                      var result = JSON.stringify(data);
  
                      for (var i = 0; i &lt; result.length; ++i) {
  
                          var popup =
                              '&lt;b&gt;Name:&lt;/b&gt; ' + data[i].Name +
                           '&lt;br/&gt;&lt;b&gt;Latitude:&lt;/b&gt; ' + data[i].Latitude +
                             '&lt;br/&gt;&lt;b&gt;Longitude:&lt;/b&gt; ' + data[i].Logitude +
                          '&lt;br/&gt;&lt;b&gt;Location:&lt;/b&gt; ' + data[i].Location;
  
  
                          L.marker([data[i].Latitude, data[i].Logitude])
                              .bindPopup(popup)
                             .addTo(map); 
  
                      }
  
                  },
                  error: function (xhr) {
  
                      console.log(xhr.responseText);
                      alert("Error has occurred..");
                  }
              });
          });
  
      &lt;/script&gt;
  </code></pre>
  
  <p></p>