Javascript function only continuing after the 'else'
<pre><code>function getNewMessages(id)
        {
            clearJqGrid();
            var lat;
            var lng;
            var jsonData;
            var geocoder = new google.maps.Geocoder();
            var miles = $('#milesAway').val();

            // find what the user is locating by
            if ($('#zipCode').is(':visible'))
            {
                var zipText = $('#zipCode').val();
                if (isValidUSZip(zipText))
                {
                    geocoder.geocode( { 'address': zipText}, function(results, status) {
                      if (status == google.maps.GeocoderStatus.OK) {
                         lat = results[0].geometry.location.lat();
                         lng = results[0].geometry.location.lng();
                         map.setCenter(results[0].geometry.location);
                      } else {
                        alert("Zip Code couldn't be located.");
                      }
                    });
                }
                else
                {
                    alert('Please enter a valid US zip code.');
                }
            }
            else if ($('#cityState').is(':visible'))
            {
                var address = $('#cityState').val();
                geocoder.geocode( { 'address': address}, function(results, status) {
                    if (status == google.maps.GeocoderStatus.OK) {
                        lat = results[0].geometry.location.lat();
                        lng = results[0].geometry.location.lng();
                        map.setCenter(results[0].geometry.location);
                    } else {
                    alert("City/State combination couldn't be found.");
                    }
                });
            }
            else
            {
                var latlng = map.getCenter();
                lat = latlng.lat();
                lng = latlng.lng();
                jsonData = 
                {
                    latitude: lat,
                    longitude: lng,
                    milesAway: miles
                }
            }

            $.ajax(
            {
                type: "POST",
                url: "&lt;%= Url.Action("CalcLocation", "Home") %&gt;",
                data: jsonData,
                success: function (result) {
                    var messages = result;
                    for(var i=0;i&lt;messages.length;i++) 
                        jQuery("#responseMessages").jqGrid(
                                                            'addRowData',
                                                            i+1,
                                                            {distance:messages[i].distance,age:messages[i].age,message:messages[i].message}
                                                          );
                },
                error: function (error) {

                }
            });
        }
</code></pre>

<p>So it's only making the AJAX call if it goes through the 'else' part of the if statement, not the others. Why?</p>
