sencha-touch-2 - sencha touch2 登录示例

标签 sencha-touch-2

我需要一个跨域用户登录请求实例,请帮帮我,谢谢!! 我的代码

Ext.data.JsonP.request({
      url: 'http://25.30.2.3:8080/newvbo/applyaction!longin',
      params: {
            username:'13881901678',
            password:'111111',
      },
      success: function(response, opts) {    
             alert('1');      
     },
     failure: function(response, opts) {
            alert('2');     
     }
});

我的问题是,我没有收到服务器返回的值,我错了吗?

最佳答案

你可以试试这个

Ext.Ajax.request({
method:'GET',
contentType:'application/json; charset=utf-8',
dataType:'json',
url:'http://........Login',
disableCaching: false,
withCredentials: true,
useDefaultXhrHeader: false,
callbackKey: 'callback',

params: {
        EmailId:Ext.getCmp('usernametwoway').getValue(),
        Password:Ext.getCmp('loginpasswordtwoway').getValue(),
        },


success:function(response)
{
        console.log(response);
        var res = response.responseText;    


        var jsonarr = Ext.decode(response.responseText);
        console.log(jsonarr);
            var myres = jsonarr[0].Result;

            console.log(myres);
        switch(myres)
            {

            case '1':
            console.log("Registration response is successfully");

            Ext.Viewport.setActiveItem({xtype:'passengerdetailstwoway'});

            break;

            case '0':
                console.log("Failed");
                Ext.Msg.alert("Error","Login Failed",Ext.emptyFn);
                break;

根据响应,您可以指定 Switch 案例..

关于sencha-touch-2 - sencha touch2 登录示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11824789/

相关文章:

sencha-touch - Sencha touch 表单面板未显示

sencha-touch-2 - 如何在拉取刷新时添加自定义更新?

javascript - 列表未填充 JsonP 代理

javascript - Sencha触摸: toolbar is not scrolling properly

sencha-touch-2 - 在水平列表中显示多个项目

extjs - 我们可以在 sencha touch 中将转换后的 Base64 图像调整为自定义尺寸吗

sencha-touch - Sencha Touch IDE 或编辑器

sencha-touch - Sencha Touch 2 MVC - 如何实现和使用自定义代理

audio - sencha Touch中的音频

extjs - 使用 store sencha touch 2 将数据加载到列表中