在 javascript 代码中,当我调用该函数时,此警报将打印 JSON,但它缺少一些值。总共有 3 个字段(2 个一组),有时它们会像这样打印:
{"":"01bce391-d3a2-4582-8e53-6a45bb583284","cast":"07392eb1-c356-4760-8f4c-
62ff164ca721"}
或者
{"":"01bce391-d3a2-4582-8e53-6a45bb583284","asd":"01bce391-
d3a2-4582-8e53-6a45345242","cast":"07392eb1-c356-4760-8f4c-62ff164ca721"}
柜台:
var counteradd=4;
$("#getButton").click(function () {
var jsonadd = {};
for(i=1; i<counteradd;i++) {
jsonadd[$('#textboxadd' + i).val()] = $('#searchaddid' + i).val();
alert('#searchaddid' + i);
alert($('#searchaddid' + i).val());
}
alert(JSON.stringify(jsonadd));
});