Its my first time to use these two technologies together. Im basing my project with this https://github.com/tsuryap/ExtJsAndNodeExample
Everything is going smoothly. But then I tried doing a login module.
Ext JS would send the data via Ext.Ajax.Request
Ext.Ajax.request({
url: '/userLogin',
params:{
username: user,
password: hexedPass
}
.....
In the Node server side it processes the data the login function that I made and calls a callback the return the response. I placed the console log just for checking purposes
app.post('/userLogin', function(req, res){
userLogin.login(connection, req, form, function(data){
console.log('READY TO SEND DATA');
return res.end(data);
});
});
So I tried testing it and i found a weird behavior. First I entered a wrong username and password
Username : a
Password : b
Log : ('READY TO SEND DATA')
Then I tried the Second Time again with wrong credentials
Username : x
Password : x
Log : ('READY TO SEND DATA')
('READY TO SEND DATA')
('READY TO SEND DATA')
I noticed that my second request processed two times and I tried doing a third one but it just keeps on increasing in number.
Furthermore sometimes the ajax request becomes pending even though my console log showed ('READY TO SEND DATA')
I also tried res.send and res.json But it gives me a Can't set headers after they are sent. Error
Please help Thank You
via Juan Carlos Cabotaje
No comments:
Post a Comment