将参数传递给ExtJs中的服务器 [英] passing parameter to server in ExtJs

查看:96
本文介绍了将参数传递给ExtJs中的服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ExtJs中是新的。

I am new in ExtJs.

当我点击按钮时,我想将我的文本框中的值传递给服务器(Servlet)。但是,因为我是新来的,我不知道如何做。

I want to pass the value in my textbox to the server(Servlet) when I click on to the button. But as I am new to it I don't kn how to do it.

请有人帮助我,或建议我一些教程或例子这个

Please someone help me into this or suggest me some tutorial or example for this

推荐答案

Ext.Ajax.request 可以帮助您。

代码将如下所示:

new Ext.Button({
    text: "Send to server",
    handler: function () {
        Ext.Ajax.request({
            url: 'myPage.php',
            success: function (){alert('Value has been sent!');},
            failure: function (){alert('Failure of sending...');},
            headers: {
                'my-header': 'foo'
            },
            params: { foo: myTextField.getValue() }
        });
    }
})

这篇关于将参数传递给ExtJs中的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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