I read a xml file as an input. I receive "undefined" as my return value while, when I put an alert message above that return bizzarely I get my correct answer ! I checked one similar problem in this topic but it didn't work for me. Seeking for help !
<script>
function FindingChildrenWithFather(Father)
{
var NodesDetails = [];
$.get('Flow.xml', function(d){
$(d).find('User').each(function(){
if ($(this).attr("SenderId") == Father)
{
NodesDetails.push($(this).attr("Id") );
}
});
});
//alert();
return NodesDetails;
}
$(document).ready(function(){
var xx = FindingChildrenWithFather('');
alert (xx);
});
</script>