1
任何人都可以幫助我。我正在使用以下代碼在jQuery Mobile中調用Web服務。但是我收到錯誤「未定義」。請指出我犯了錯誤的地方。提前致謝。JQueryMobile - AJAX - JSON解析
編碼:
$.ajax({
type: 'POST',
url: "http://jquery.sample.com/nodes.json",
data: ({search_keys :theName}),
dataType: 'json',
timeout: 5000,
success: function(msg)
{
console.log(msg); //here, I can see the result in browser.
alert(msg.message); //Undefined Error
},
error: function(xhr, status, errorThrown)
{
alert(status + errorThrown);
}
});
JSON輸出
[ { 「類型」: 「業務配置文件」, 「標題」: 「萊克維爾餐館」, 「用戶」:」 canwest「, 」date「:」1280144992「, 」node「:{ 」nid「:」67916「, 」type「:」business_profiles「, 」language 「:」」, 「UID」: 「1」, 「狀態」: 「1」, 「創造」: 「1278994293」 }} ]
感謝尼克Craver。 – Finder 2010-12-08 09:22:45