ExtJs 4.1:如何使用Ext.Ajax.request()在请求体中发送json数据?

我想使用Ext.Ajax.request()发送json数据,然后在ASP.NET中使用Request.InputStream访问它,它是请求体的内容.我需要一种方法来告诉ExtJs在使用Ext.data.proxy.Ajax时,在请求正文中写入数据.
指定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',jsonData: writer.getRecordData(record),failure: function() {
        console.log('woops');
    }
});

相关文章

IE6是一个非常老旧的网页浏览器,虽然现在很少人再使用它,但...
PHP中的count()函数是用来计算数组或容器中元素的个数。这个...
使用 AJAX(Asynchronous JavaScript and XML)技术可以在不...
Ajax(Asynchronous JavaScript and XML)是一种用于改进网页...
本文将介绍如何通过AJAX下载Excel文件流。通过AJAX,我们可以...
Ajax是一种用于客户端和服务器之间的异步通信技术。通过Ajax...