ExtJS的4.2:如何正确的Ext.Ajax.Request POST发送参数 [英] Extjs 4.2: How to send parameters properly in a Ext.Ajax.Request POST

查看:1532
本文介绍了ExtJS的4.2:如何正确的Ext.Ajax.Request POST发送参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须做一个POST从我的ExtJS的脚本,以删除我的数据库的内容:

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:

我可以使用@RequestParam得到我的控制器的参数。

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 (i will vote you positive and i check the correct answer)

推荐答案

现在的问题是,你正在使用的行标题:{内容类型:text / html的'} 在你原来的问题。这集的内容是发布数据内容为text / html来代替。

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆