10

を使用してjsonデータを送信し、リクエストボディのコンテンツであるExt.Ajax.request()ASP.NETでアクセスしたいと思います。Request.InputStreamExtJs に、Ext.data.proxy.Ajax.

4

1 に答える 1

27

メソッドを指定POSTし、リクエストのjsonData設定を使用します。

Ext.Ajax.request({
    url: 'myUrl',
    method: 'POST',
    params: {
        requestParam: 'notInRequestBody'
    },
    jsonData: 'thisIsInRequestBody',
    success: function() {
        console.log('success');
    },
    failure: function() {
        console.log('woops');
    }
});

JSONとして記述されたレコードが必要な場合は、このようなJSONライターも使用できます。

var writer = Ext.create('Ext.data.writer.Json'),
    record = Ext.getStore('SomeStoreID').first();

Ext.Ajax.request({
    url: 'myUrl',
    method: 'POST',
    params: {
        requestParam: 'notInRequestBody'
    },
    jsonData: writer.getRecordData(record),
    success: function() {
        console.log('success');
    },
    failure: function() {
        console.log('woops');
    }
});
于 2012-09-17T17:04:01.527 に答える