1

次のコードがあります

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 は {"author":"The author here"} を返します

ここでの間違いは何ですか?

4

1 に答える 1

3

いくつかの調査の後、私は答えを見つけました:

トリックは、これを成功関数に入れることです

// resp is the XmlHttpRequest object
var options = Ext.decode(resp.responseText).author;
alert(options);
于 2012-06-08T19:14:41.783 に答える