unable to store one function value in variable
<p>im getting value from  jquery ajax call but unable to save in global variable, which value i want to use in another function. i want to get assign  dustValue  in  initialize function.</p>

<p>javascript code</p>

<pre><code>var dustValue;
$.ajax({
    type: "GET",
    url: "http://my url",
    dataType: "json",
    success: function (data) {
        dustValue = data.sensorsdata.PHValue;
    }
});
var myCenter = new google.maps.LatLng(22.8046, 86.2029);
function initialize() {
    var mapProp = {
        center: myCenter,
        zoom: 17,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
    var value = dustValue;//78.55
    var dustbinstatus = '';

    if (value &lt; 50) {
        dustbinstatus = 'img/dustbinempty.png';
    } else if (value &gt; 50 &amp;&amp; value &lt; 90) {
        dustbinstatus = 'img/dustbinfull.png';
    } else if (value &gt; 90) {
        dustbinstatus = '3.jpg';
    }

    var marker = new google.maps.Marker({
        position: myCenter,
        icon: v_icon
    });
        marker.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</code></pre>

<p>body </p>

<pre><code> &lt;div id="googleMap" style="width:1580px;height:780px;"&gt;&lt;/div&gt;
</code></pre>