Function does not return object in javascript
<p>I am returning an object in function but it returns <code>undefined</code> why? here is my code</p>

<pre><code>parseXML = function (xml) {
        return {
            lon  : $(xml).find('GEOCODE').find("LOC").attr('lon'),
            lat  : $(xml).find('GEOCODE').find("LOC").attr('lat'),
            x    : $(xml).find('GEOCODE').find("LOC").attr('x'),
            y    : $(xml).find('GEOCODE').find("LOC").attr('y')
        };
    },

    searchRoute = function () {
        var userloc, dest; 
        userloc = cityattr.init(from, to, fromurl, parseXML);
        //dest    = cityattr.init(from, to, fromurl, parseXML);

        console.log(userloc);
    };
</code></pre>

<p><strong>Update</strong></p>

<p>When I do <code>console.log()</code> inside parseXML then it returns correct object</p>

<pre><code>parseXML = function (xml) {
        var obj = {
            lon  : $(xml).find('GEOCODE').find("LOC").attr('lon'),
            lat  : $(xml).find('GEOCODE').find("LOC").attr('lat'),
            x    : $(xml).find('GEOCODE').find("LOC").attr('x'),
            y    : $(xml).find('GEOCODE').find("LOC").attr('y')
        };

        console.log(obj);
    },
</code></pre>

<p><strong>Update 2</strong></p>

<p>still return <code>undefined</code></p>

<pre><code>parseXML = function (xml) {
        return {
            lon  : $(xml).find('GEOCODE').find("LOC").attr('lon'),
            lat  : $(xml).find('GEOCODE').find("LOC").attr('lat'),
            x    : $(xml).find('GEOCODE').find("LOC").attr('x'),
            y    : $(xml).find('GEOCODE').find("LOC").attr('y')
        };
    },
</code></pre>

<p>here is code for cityattr</p>

<pre><code>var Xml = function () {
var to, from, url, result,

    init = function (fromaddress, toaddress, link, callback) {
        from    = fromaddress;
        to      = toaddress;
        url     = link;

        requestXml(callback);
    },

    requestXml = function (callback) {
        $.ajax({
            type: "GET",
            url: url,
            dataType: "xml",
            success: callback
        });
    },

    getResult = function () {
        return result;
    };

 return {
    init        : init,
    getResult   : getResult
 };
};
</code></pre>
