ChillsNL
3 May 2011, 5:17 AM
Hello people,
My app is slowly taking more of his shape and yesterday i'd made an dynamic form. Now i'm trying to make some things more dynamically. The first step of everything is an log in form.
When the button has been pressed on the log-in form, the handler calls out a function with an Ext.Ajax.request.
Unfortunally, it doesn't work because i can't send params with it. I've tested it with an endpoint who needs no params, and that works. Only when there are params involved, the Request ends up as an 400 bad request.
Someone willing to look for me?
The only problem is that my webservice accept params in the form of: '{"GWUserName":"[var]","GWPassword":"[var]"}'. Noticed that [var] needs to be replaced by the filled in username and password.
Code:
function Login()
{
LoginName = FWM.LoginForm.getValues().name;
LoginPass = FWM.LoginForm.getValues().password;
sParams = '{"GWUserName":"'+LoginName+'","GWPassword":"'+LoginPass+'"}';
Ext.Ajax.request
({
url: 'GWService.svc/GWEndPoint/CheckLogin',
method: 'POST',
params: sParams,
success: function(response)
{
console.log(response.responseText);
},
failure: function(response)
{
console.log(response.responseText);
}
});
}
or
function Login()
{
LoginName = FWM.LoginForm.getValues().name;
LoginPass = FWM.LoginForm.getValues().password;
Ext.Ajax.request
({
url: 'GWService.svc/GWEndPoint/CheckLogin',
method: 'POST',
params:
{
GWUserName:LoginName,
GWPassword:LoginPass
},
success: function(response)
{
console.log(response.responseText);
},
failure: function(response)
{
console.log(response.responseText);
}
}) ;
console.log(Login_Check);
}
Both give me the 400 bad request.
Anyone?
My app is slowly taking more of his shape and yesterday i'd made an dynamic form. Now i'm trying to make some things more dynamically. The first step of everything is an log in form.
When the button has been pressed on the log-in form, the handler calls out a function with an Ext.Ajax.request.
Unfortunally, it doesn't work because i can't send params with it. I've tested it with an endpoint who needs no params, and that works. Only when there are params involved, the Request ends up as an 400 bad request.
Someone willing to look for me?
The only problem is that my webservice accept params in the form of: '{"GWUserName":"[var]","GWPassword":"[var]"}'. Noticed that [var] needs to be replaced by the filled in username and password.
Code:
function Login()
{
LoginName = FWM.LoginForm.getValues().name;
LoginPass = FWM.LoginForm.getValues().password;
sParams = '{"GWUserName":"'+LoginName+'","GWPassword":"'+LoginPass+'"}';
Ext.Ajax.request
({
url: 'GWService.svc/GWEndPoint/CheckLogin',
method: 'POST',
params: sParams,
success: function(response)
{
console.log(response.responseText);
},
failure: function(response)
{
console.log(response.responseText);
}
});
}
or
function Login()
{
LoginName = FWM.LoginForm.getValues().name;
LoginPass = FWM.LoginForm.getValues().password;
Ext.Ajax.request
({
url: 'GWService.svc/GWEndPoint/CheckLogin',
method: 'POST',
params:
{
GWUserName:LoginName,
GWPassword:LoginPass
},
success: function(response)
{
console.log(response.responseText);
},
failure: function(response)
{
console.log(response.responseText);
}
}) ;
console.log(Login_Check);
}
Both give me the 400 bad request.
Anyone?