Extjs 4.2:如何在 Ext.Ajax.Request POST 中正确发送参数 [英] Extjs 4.2: How to send parameters properly in a Ext.Ajax.Request POST
问题描述
我必须从我的 ExtJs 脚本中执行 POST 才能从我的数据库中删除某些内容:
Ext.Ajax.request({url: 'deleteRole.html',方法:'POST',标头:{'Content-Type':'text/html'},waitTitle: '正在连接',waitMsg: '发送数据...',参数:{角色名": 角色名},范围:这个,成功:收到,失败:function(){console.log('failure');}});
当帖子发送时,我可以在萤火虫中看到字体中的角色名称,但不是参数.我想向您展示另一篇关于用户注册的帖子(用 spring:form 制作).如果我检查帖子,我可以看到以下内容:
因此,我的弹簧控制器没有检测到任何参数.我的帖子有问题吗? 谢谢 问题是您在使用 I have to do a POST from my ExtJs script in order to delete something from my DB: 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: 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: 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 这篇关于Extjs 4.2:如何在 Ext.Ajax.Request POST 中正确发送参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
(来源:
(来源:subirimagenes.com)>headers: {'Content-Type': 'text/html'},
行你原来的问题.这会将内容设置为 text/html 而不是发布数据的内容.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');}
});
(source: subirimagenes.com)
(source: subirimagenes.com)headers: {'Content-Type': 'text/html'},
in your original question. This would set the content to text/html instead of the content being post data.