Wait for the function to execute..
Hi guys!
This question is more syntax oriented I think. I have a problem with a function wait.
I have a return that return object in one file:
function get_rss_data(url)
{
return data;
}
I use Include to include it to app.js.
in app.js I call it with:
var results = get_rss_data('http:...');
Ti.API.info("results: "+result.length);
When i run the app application does not wait for the get_rss_data to finish and that is why the Ti.API.info is null. How can I write the code in app.js to wait for the get_rss_data to finish? Thanks!
Kind regards, Miha
1 Answer
-
Accepted Answer
if you use a xhr inside your get_rss_data, this is done asynchronous, so you need to create a function triggered at onComplete event for the xhr that will use the data now available.