×

Please give details of the problem

Skip to content

How to create an array from the result of a webservice

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
function get_array (my_father,my_son) {
    if (typeof(my_father) == "object") {
        if (my_father[my_son] != undefined) {
            if (my_father[my_son].length != undefined) {
                var my_array = my_father[my_son];
            }
            else {
                var my_array = [my_father[my_son]];
            }
        }
        else {
            var my_array = [];
        }
    }
    else {
        var my_array = [];
    }
    return my_array;
}