相关疑难解决方法(0)

问题使用json.js对多维数组进行字符串化

我有问题.stringify(),但我认为我的JavaScript数组一定是错的,这是我的代码:

var questions = new Array();

$('#Valid').hover(function(){
    for (i=0;i < $('.Questions').length;i++){
        questions[i]=new Array();
        questions[i]['numero']=$('.Numero:eq('+i+')').html();
        questions[i]['question']=$('.ItemInput:eq('+i+')').val();
        questions[i]['variable']=$('.VarName:eq('+i+')').val();
    }

    var stringJSON=JSON.stringify(questions)
    alert (stringJSON)
})
Run Code Online (Sandbox Code Playgroud)

stringJSON var返回:

[[]]
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

javascript jquery json

11
推荐指数
2
解决办法
2万
查看次数

标签 统计

javascript ×1

jquery ×1

json ×1