I'm trying to JSON.stringify an associatif array in javascript, when i console.log it the output is :
Array[0]
adresse:
"zfzf"
adresse2:
"zfz"
adresse3:
"fzfz"
code_postal
"fzfz"
[...]
length:
0
[...]
__proto__:
Array[0]
as you can see the lenght is equal to 0, so when i JSON.Strigify it, the answer is [ ]
i use to build my array like this :
var info = [];
$("[data-change]").each(function(key,obj){
if ($(obj).val() == "") {
i = 1;
}
else {
info[$(obj).attr("name")] = $(obj).val();
j++;
}
});
all those "data-change" are inputs, i've tryied to use the variable j instead of $(obj).attr("name")] and it works but i neeed the key to be the name of the input