守则如下:不能设置正确的内容类型的Ext.Ajax.request
Ext.Ajax.request({
url: url,
method: 'POST',
headers: { 'Content-Type': 'application/json' },
jsonData: {
textMatchStyle:"substring",
fields: ["packageName","name","tableName"],
data: {_domain:null,_domainContext:{},operator:"and",criteria:[]},
limit: 40,
offset: 0
},
success: function(response) {
console.log('Success');
},// function called on success
failure: function(result) {Ext.MessageBox.alert('Error', 'Some problem occurred');},
});
这要根据ExtJS的文档工作,但在请求头
Content-Type application/x-www-form-urlencoded,text/javascript; charset=UTF-8
哪导致问题,因为我的服务器需要application/json
格式的发布数据,而不是在application/x-www-form-urlencoded
我也在ext-forums上搜索过,但无法使其工作。
有问题在我的代码或它的bug在extjs?
请帮忙。
您使用的是什么版本的ExtJS? 4.1.1似乎很好。 – xblitz