1
我試圖解析收到的JSON對象,但是obj始終爲空並且obj.d未定義。哪裏有問題?jQuery JSon未解析
JSON響應
{"d":"psize=a4&porient=portrait&margintop=10&marginleft=5&marginright=5&marginbottom=10&title=&author=&subject=&keywords=&userpass=&ownerpass=&coverpage=http%3A%2F%2F&conversiondelay=1&allowscript=true"}
其調用服務器,並從服務器
$.ajax({
type: "POST",
url: "Default.aspx/LoadOptions",
data: "",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
var obj = $.parseJSON(data);
console.log(obj.d);
},
error: ""
});
不是「json對象」... JavaScript對象:) –
@Felix King,修正了,謝謝! – Dogbert