当我尝试解析我的 json 数据时……我明白了……
[object object],[object object],[object object]....
我的代码是这样的......
var json
function go(){
json = jQuery.parseJSON($('#json').val());
alert(json);
}
我的json看起来像这样......
[{"Jenis Bahan":"sp100roll","Lebar":"160","Harga / Meter":"4300"},{"Jenis Bahan":"sp100ecer","Lebar":"160","Harga / Meter":"5300"},{"Jenis Bahan":"sp75ecer","Lebar":"160","Harga / Meter":"4300"},{"Jenis Bahan":"sp75roll","Lebar":"160","Harga / Meter":"3800"},{"Jenis Bahan":"sp50roll","Lebar":"160","Harga / Meter":"2800"},{"Jenis Bahan":"a","Lebar":"b","Harga / Meter":"c"},{"Jenis Bahan":"a","Lebar":"b","Harga / Meter":"c"},{"Jenis Bahan":"a","Lebar":"b","Harga / Meter":"c"}]
我的问题是..如何获得这样的警报结果...
Name = sp100roll value = 160-4300
Name = sp75ecer value= 160-5300
......
但最后是..我想从中创建一个选择框选项..所以它会是这样的......
<option value="160-4300">sp100roll</option>
<option value="160-5300">sp75ecer</option>
and etc...
任何人都可以帮忙吗?
我已经尝试了很多答案但仍然没有工作..