zoukankan      html  css  js  c++  java
  • ASP.NET MVC 4使用extjs传递对象至后台方法

    使用extjs创建页面,代码如下:

     buttons: [{
                            xtype: 'button',
                            text: '登录',
                            formBind: true,
                            disabled: true,
                             70,
                            height: 26,
                            handler: function () {
                                var mdl = new Object();
                                var count = Ext.getCmp('count').getValue();
                                var psw = Ext.getCmp('psw').getValue();
                                mdl.Count = count;
                                mdl.Password = psw;
                                Ext.Ajax.request({
                                    url: 'Home/ValidCount',
                                    params: mdl,
                                    method: 'post',
                                    success: function (response) {
                                        var responseArray = Ext.decode(response.responseText);
                                        alert(response.responseText);
                                    },
                                    failure: function () {
                                        alert('false');
                                    }
                                });
                            }
                        }, {
                            xtype: 'button',
                            text: '取消',
                             70,
                            height: 26,
                            handler: function () {
                                this.up('form').getForm().reset();
                            }
                        }]

    开始的时候使用mdl=[];

    mdl.push({Count:count,Password:psw});没有成功,改为以上代码后成功了,

    后台方法如下:

    [HttpPost]
    public JsonResult ValidCount(LoginMdl mdl)
    {
    return Json(mdl);
    }

  • 相关阅读:
    3.27上午
    3.24上午 补
    2017.3.27下午
    2017.3.27上午
    2017.3.24下午
    2017.3.24上午
    2017.3.23下午
    2017.3.23上午
    2017.3.22上午
    2017.3.21下午
  • 原文地址:https://www.cnblogs.com/wangq0126/p/3505015.html
Copyright © 2011-2022 走看看