.ajax can t find,Sencha Touch AJAX Request Issue: ReferenceError: Can't find variable: request

We are building an application using Sencha Touch 1.1 and PhoneGap 1.3.0 for deployment to iOS.

Our app makes several AJAX requests to authenticate a user and retrieve data from the server. All of our requests execute correctly with the exception of attempting to authenticate using invalid credentials.

I am using Weinre to debug the app running in the iOS simulator.

In the Network pane the request hangs on "Pending", and in the console I receive the following error:

error occurred: undefined:[unknown lineno]: ReferenceError: Can't find variable: request

this error appears when the timeout value has been reached.

Here's the code for my controller:

Ext.regController('Login', {

login: function(options)

{

var loader = this.application.viewport.query('#loader')[0];

loader.show();

var string = options.user + ":" + options.pass;

var encodedString = Ext.util.Base64.encode(string) + "==";

Ext.Ajax.defaultHeaders = { Authorization: "Basic " + encodedString};

Ext.Ajax.request({

url: 'http://test.com/login.do',

method: 'POST',

timeout: 5000,

scope: this,

callback: function (options, success, response) {

if (success){

buildingStore.load({

callback: function (){

Ext.redirect('Main/loggedIn');

loader.hide();

}

});

Ext.redirect('Main/loggedIn');

}

else {

alert("failed");

console.log(response.status);

loader.hide();

var loginFailure = new Ext.Panel ({

floating: true,

centered: true,

floating: true,

modal: true,

layout: 'fit',

cls: 'loginError',

html: 'Login was unsuccessful.
Please try again.',

});

loginFailure.show();

}

}

});

Ext.Ajax.on({

requesterror: function(conn, response, options, e){

alert("error");

},

requestexception: function(conn, response, options, e){

alert("exception");

}

});

},

});

and a screenshot of Weinre:

KqKk8.png

Thanks for your help!

Kevin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值