Deferred.done callback not working in the done function
<p>I have been trying to make this work for couple of days now, my last attempt.</p>

<p>And my apologies for posting different questions with similar objective.</p>

<p>I just tried to figure it out with the best way.</p>

<p>Here is the thing; I have some data in another page that I want to use in my initialize function.</p>

<p>One member here suggested that I use deferred.done. </p>

<p>It partially worked. My data in other page is loaded and I can get it displayed if I have <strong>alert(MapData);</strong> in the initialize function.</p>

<p>BUT when I try to use that data in the initialize function for the actual work, I get <strong>MapData.users is undefined</strong> error.</p>

<p>I dont get it because it appears fine when I loaded in an alert box.</p>

<p>Please suggest!</p>

<pre><code>    $(function CheckinMap() {
        $.when($.ajax({
            type: "GET",
            url: "content/home/index.cs.asp?Process=ViewCheckinMap"
        })).done(      function initialize(data) {
            var MapData = data;
            var center = new google.maps.LatLng(48.404840395764175, 2.6845264434814453);
            var map = new google.maps.Map(document.getElementById('checkinmap'), {
              zoom: 2,
              center: center,
              mapTypeId: google.maps.MapTypeId.ROADMAP,
              maxZoom: 4
            });
            var markers = [];
            for (var i = 0; i &lt; MapData.users.length; i++) {
              var location = MapData.users[i];
              var latLng = new google.maps.LatLng(location.latitude,
                  location.longitude);
              var marker = new google.maps.Marker({
                position: latLng
              });
              markers.push(marker);
            }
            var markerCluster = new MarkerClusterer(map, markers);
        });
    });
</code></pre>

<p>This is the data that I need to use in my initialize function.</p>

<pre><code>{
  "users": [
    {
      "latitude": "48.405163",
      "longitude": "2.684659"
    },
    {
      "latitude": "43.7347242529278",
      "longitude": "7.42198348045349"
    }
  ]
};
</code></pre>
