0
我想這個jQuery代碼:JQuery的歸國從PHP JSON字符串未定義
val = $(this).val();
var data = {
"action": "test"
};
data = $(this).serialize() + "&" + $.param(data);
$.ajax({
type: "POST",
dataType: "json",
url: "?getCustomer=1&sequence="+val+"",
data: data,
success: function(data) {
alert(data["sequence"]);
}
});
但alert
正在返回undefined
如果我查詢的網址(?getCustomer=1&sequence=4
)我得到這個返回:
[{"sequence":"53"}]
所以序列值肯定是
這就是示出了在控制檯:
[Object]0: Objectsequence: "112"__proto__: Objectlength: 1__proto__: Array[0]concat: concat()constructor: Array()copyWithin: copyWithin()entries: entries()every: every()fill: fill()filter: filter()find: find()findIndex: findIndex()forEach: forEach()indexOf: indexOf()join: join()keys: keys()lastIndexOf: lastIndexOf()length: 0map: map()pop: pop()push: push()reduce: reduce()reduceRight: reduceRight()reverse: reverse()shift: shift()slice: slice()some: some()sort: sort()splice: splice()toLocaleString: toLocaleString()toString: toString()unshift: unshift()Symbol(Symbol.iterator): values()Symbol(Symbol.unscopables): Object__proto__: Object
是什麼的console.log(數據)顯示? – ahervin
它已經有 – charlie
檢查我的更新 - wouldnt適合評論 – charlie