return value to function within a function
<p>Trying to get a return value from getUrl function but it comes back as undefined.<br/> 
I would appreciate any help. </p>

<p>Thanks<br />
Here is the code:</p>

<pre><code>function createXmlFicaRsi(xmlDoc,xmlFileName) {     
    var mystr = "&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;result&gt;&lt;rows&gt;"+strStor+"&lt;/rows&gt;&lt;/result&gt;"
    jQuery(document).ready(function(){ 
      jQuery("#fRsiGrid").jqGrid({
        datatype: 'xmlstring',
        datastr : mystr,
        colNames:['Year','Earnings', 'Amt&lt;br/&gt;Needed &lt;br/&gt;1 QC','Amt&lt;br/&gt;Needed &lt;br/&gt;4 QC','#&lt;br/&gt;of&lt;br/&gt; QCs','Monthly&lt;br/&gt;Under FRA','Yearly&lt;br/&gt;Under FRA','Monthly&lt;br/&gt; Yearly of&lt;br/&gt; Attain.&lt;br/&gt; FRA','Year of&lt;br/&gt; Attain. of&lt;br/&gt; FRA','YOC*','Sum of&lt;br/&gt;Post-1977&lt;br/&gt;YOCs'],
        colModel :[ 
            {name:'yearRsi', index:'yearRsi', width:55, resizable:false, align:'center', sorttype:'int'},
            {name:'earnRsi', index:'earnRsi', width:65, resizable:false, align:'right', sortable:false}, 
            {name:'1qcRsi', index:'1qcRsi', width:65, resizable:false, align:'right', sortable:false}, 
            {name:'4qcRsi', index:'4qcRsi', width:65, resizable:false, align:'right', sortable:false}, 
            {name:'numqcRsi', index:'numqcRsi', width:40, resizable:false, align:'right', sortable:false}, 
            {name:'mfra', index:'mfra', width:65, resizable:false, align:'right', sortable:false}, 
            {name:'yfra', index:'yfra', width:65, resizable:false, align:'right', sortable:false},
            {name:'myafra', index:'myafra', width:85, resizable:false, align:'right', sortable:false},
            {name:'yafra', index:'yafra', width:65, resizable:false, align:'right', sortable:false},
            {name:'yoc', index:'yoc', width:65, resizable:false, align:'right', sortable:false},          
            {name:'sumpost', index:'sumpost', width:60, resizable:false, align:'right', sortable:false} ],     
        rowNum:-1,      
        hidegrid: false,
        width: 760, 
        height: 460,
        shrinkToFit: false,         
        caption: '&lt;span id=fRsiGrid_caption&gt;FICA Earnings, QC, AET and YOC amounts after 1977&lt;/span&gt;'       
      });     

      $('.ui-jqgrid .ui-th-column').css('height', '40px');
      $('.ui-jqgrid .ui-jqgrid-htable th div').css('height', '40px'); 
      $('.ui-jqgrid-title').css('font-size', '.8em');//Font size for title
      $('.ui-jqgrid .ui-th-column').css('font-size', '.7em');//Font size for header content 
      $('#fRsiGrid_caption').append("&lt;span id='whatLink' style='font-size:large;color:blue;text-decoration:none;cursor:pointer'&gt;*&lt;/span&gt;");     

    }); 
    $('#jqgh_1qcRsi').addClass("gridLink");
    $('#jqgh_4qcRsi').addClass("gridLink");
    $('#jqgh_mfra').addClass("gridLink");
    $('#jqgh_yfra').addClass("gridLink");
    $('#jqgh_myafra').addClass("gridLink");
    $('#jqgh_yafra').addClass("gridLink");
    $('#jqgh_yoc').addClass("gridLink");

    $("#jqgh_1qcRsi").click(function() {
        var nurl = getUrl("QueryView-QC");
        alert(nurl);        
    }); 
}

function getUrl(urlNm){
    DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'getUrls', urlNm, doQueryResults);
    function doQueryResults(r){     
        xmlDoc = loadXMLString(r);      
        y = xmlDoc.getElementsByTagName("URL");

        for (i = 0; i &lt; y.length; i++) {            
            url = y[i].attributes.getNamedItem("val").nodeValue;            
            if (url == urlNm)
            {                           
                url = y[i].childNodes[0];
                //alert(url.nodeValue);
                url = url.nodeValue;
                return url;
            }           
        }   
    }
}   
</code></pre>
