Error returning data from JS array

0

I need to assign the attributes to the object relatively, without knowing how many parameters will come, so it is not returning results, is there another method?

    var menu = document.getElementById("funcaoMenu").value;

    res = menu.split(","); //divide os resultados pela "," e cria um array


    oi = new Object(); // instância um novo objeto


    for (var i = 0; i < res.length; i++) {
        oi.i = res[i]; // recebe os dados do array e alterna a chave
    };

The data I get are parameters in string, for example: "menu", "footer", "hello".

I need to run this data in a parameter in php to use the function and func_num_args and func_get_args.

    
asked by anonymous 18.09.2016 / 20:01

1 answer

1

I think you should do the assignment like this:

oi[i] = res[i];
    
18.09.2016 / 20:12