Extjs 4.2:如何在Ext.Ajax.Request POST中正确发送参数 [英] Extjs 4.2: How to send parameters properly in a Ext.Ajax.Request POST
问题描述
Ext.Ajax。 request({
url:'deleteRole.html',
method:'POST',
headers:{'Content-Type':'text / html'},
waitTitle :'连接',
waitMsg:'发送数据...',
参数:{
rolename:rolename
},
范围:this,
success:received,
failure:function(){console.log('failure');}
});
当发送信息时,我可以在firebug中看到rolename的字体,但不能作为参数。我想向用户显示另一个帖子(用spring:form)。如果我检查帖子,我可以看到以下内容:
image http://s2.subirimagenes.com/otros/previo/thump_8498731post.jpg
我可以得到参数我的控制器使用@RequestParam。
但是在发布中我有问题我看不到参数部分,我只能看到Font(Fuente)部分: / p>
image2 http:// s2 .subirimagenes.com / otros / previo / thump_8498737delete.jpg
因此,我的弹簧控制器没有检测到任何参数。在我的POST中有什么问题吗?
谢谢
问题是您在原始问题中使用头:{'Content-Type':'text / html'},
行。这将把内容设置为text / html,而不是发布数据的内容。
I have to do a POST from my ExtJs script in order to delete something from my DB:
Ext.Ajax.request({
url: 'deleteRole.html',
method: 'POST',
headers: {'Content-Type': 'text/html'},
waitTitle: 'Connecting',
waitMsg: 'Sending data...',
params: {
"rolename" : rolename
},
scope:this,
success: received,
failure: function(){console.log('failure');}
});
when the post is sent i can see in the firebug the rolename in font but not as a param. I would like to show you another post (made with spring:form) relative to the user registration. If i inspect the post i can see the following:
image http://s2.subirimagenes.com/otros/previo/thump_8498731post.jpg
And i can get the parameters in my controller using @RequestParam.
But in the post that i have problems i can't see the parameters part, i can only see the Font(Fuente) part:
image2 http://s2.subirimagenes.com/otros/previo/thump_8498737delete.jpg
As a consequence, my spring controller does not detect any parameter. Is it something wrong in my POST?
Thank you
The problem is that you are using the line headers: {'Content-Type': 'text/html'},
in your original question. This would set the content to text/html instead of the content being post data.
这篇关于Extjs 4.2:如何在Ext.Ajax.Request POST中正确发送参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!