[eluser]shankar ganesh[/eluser]
Hi all,
I am need to call the function one after another, ie, the first function should complete the complete task and then second function to be triggered and after completing the second function's tasks third function need to called.
How can this can be accomplished using jquery and delay() should not be used.
eg:
There are 2 function
1. Load json files()
2. Display json files()
Code:
var ALL_RESULTS = new Arrary();
var MASTER_RESULT = new Arrary();
function load_json_files()
{
for(i=0;i<MASTER_RESULT.length;i++)
{
$.getJSON(MASTER_RESULT[i], function(result) {
ALL_RESULTS[i] = result;
});
}
display_json_files();
}
function display_json_files()
{
alert(ALL_RESULTS.length);
}
In the above eg MASTER_RESULT.length = 12, after completely loading all 12json files the second function display_json_files() need to be triggered.
But its not, the function display_json_files() is called before completely loading all the json files.
Is there any other way to accomplish this apart from using delay().
Thanks in advance.