任何人都知道我是怎么来的:
var guests = [];
for (var i = 0; i < parseInt(apartments) ; i++) {
var pos = i + 1;
var adults, children, infants;
adults = $("#adults" + pos).val();
infants = $("#infants" + pos).val();
children = $("#children" + pos).val();
guests.push({ Leg: pos, Adults: adults,
Children: children, Infants: infants
});
}
对此事:
Guests: [{ Leg: "1", Adults: "2", Children: "0", Infants: "2" },{ Leg:
"2", Adults: "2", Children: "1", Infants: "0" }]
答案 0 :(得分:0)
使用
JSON.stringify(guests);
我认为应该这样做。