I have the following Javascript function:
function GetUniversity()
{
$.getJSON(AddressAccess+"Home/university/format/json",
function(data)
{
data = data[0];
return data;
});
}
Now I when I test the data in the function the data var definitely has data returned from the url. Now here is my code for where I call this function:
$(document).on('pagebeforeshow','#searchpage',
function()
{
var UniveristyDat = null;
UniveristyData = GetUniversity();
alert(UniveristyData.Name);
var out = '';
for(i in UniveristyData)
{
out+= i + ' ' + UniveristyData[i] + "\n";
}
alert(out);
}
);
Now in theory the UniveristyData var should have contense returned to it but for some reason its null. Not to sure what is going on here.