我正在使用一些json數據,並且在結果集中我有5組信息可供選擇。使用javascript獲取特定的json值
在我的javascript我可以看到作爲對象返回的數據時,我調用線console.log(contacts.data["all"]);
的輸出的一個示例是如下這與調試窗口從鉻
0: Object allowanyoneedit: "True" allowedit: "1" charindex: "A" country: "AF" email: "[email protected]"
在我有我想要的電子郵件信息的數據中,
所以如果我有;
0: Object
allowanyoneedit: "True"
allowedit: "1"
charindex: "A"
country: "AF"
email: "[email protected]"
1: Object
allowanyoneedit: "True"
allowedit: "1"
charindex: "A"
country: "AF"
email: "[email protected]"
,我想回到選項1:從JSON對象如何將我做到這一點使用JavaScript ===================== ====編輯=========================
這是我知道我通過獲取數據的塊陣列
for (var x in companies) {
var company = companies[x];
var opt = $("<option>").attr({ value: company.id }).text(company.name);
$("#contactcompany").append(opt);
console.log(company);
//$("#txtEmailTo").val();
console.log(contacts.data["all"]);
在我與工作的例子有陣列
在5個對象== ======================編輯2 ========================== ====
Data += "{"
For Each item In Columns.Split(",")
Dim Val As String = FormatJS(myReader(item).ToString)
If Val <> "" Then Data += """" & item.ToLower & """:""" & Val & ""","
Next
If CBool(myReader("AllowEdit").ToString) = True Then
Dim Val As String = FormatJS(myReader("AllowEdit").ToString)
If Val <> "" Then Data += """allowedit"":""" & Val & """"
End If
If Data.EndsWith(",") Then Data = Data.Remove(Data.Length - 1)
Data += "},"
'的console.log(contacts.data [ 「所有」] [1]) ;'?雖然看到完整的代碼示例會很高興。 – j08691
在這種情況下你需要看到哪一點?因爲這不是我的代碼,這就是爲什麼我掙扎。 –