2012-06-08 93 views
1

我有以下代碼ExtJS的報警響應

Ext.Ajax.request({ 
    url: 'newRecord.php', 
    method: 'POST', 
    type: 'json', 
    params: { 
     "author" : list.Author, 
     "title" : list.Title, 
     "manufacturer" : list.Manufacturer, 
     "product_group" : list.ProductGroup 
    }, 
    success: function(response) { 
     alert(response.author); 
    }, 
    failure: function() { 
     alert('Failure'); 
    } 
}); 

警報返回undefined但是我的PHP返回{「作者」:「這裏的作者」}

什麼是這裏的錯誤呢?

回答

3

我找到了答案經過一番研究:

訣竅是把這個成功的功能

// resp is the XmlHttpRequest object 
var options = Ext.decode(resp.responseText).author; 
alert(options); 
+0

參數'型:在您的要求的配置「json''是沒用的。你把它拿到了哪裏? –

+0

顯然,這不是沒用,它沒有工作沒有 – Grigor

+0

但我無法在文檔中找到它。也許我只是想念一些東西。你能給我一個鏈接嗎? –