I think no quotes:
data: { "name_of_ username_field": "username_field_value",
"name_of_password_field": "password_field_value",
"_formkey": "form_key_value",
"_formname": "formname_value" }
The problem is that you do not know the formkey until the form is
generated and then filled by the user. You need to use jQuery
serialize to serialize the existing form. You cannot build the data
yourself.
On Sep 10, 1:05 am, eddwinston <[email protected]> wrote:
> Hi,
>
> I am away from my app right now but I guess it would be something like
> this:
>
> data: '{ "name_of_ username_field": "username_field_value",
> "name_of_password_field": "password_field_value",
> "_formkey": "form_key_value",
> "_formname": "formname_value" }'
>
> On Sep 10, 8:45 am, mdipierro <[email protected]> wrote:
>
> > But this line
>
> > data: {},
>
> > is not sending the username and password to the login page. It should
> > also send the formkey and formname.
>
> > On Sep 10, 12:11 am, eddwinston <[email protected]> wrote:
>
> > > Hi,
>
> > > This is what I did:
>
> > > jQuery.ajax({
> > > type: "POST",
> > > url: "{{=URL(r=request,c='default', f='user', args='login'}}",
> > > data: {},
> > > success: function(response) {
> > > alert(response); // This line produced a complete page markup in
> > > the alert dialog
> > > },
> > > error: failure_callback
> > > });
>
> > > On Sep 10, 6:31 am, mdipierro <[email protected]> wrote:
>
> > > > show us the code
>
> > > > On Sep 9, 10:21 pm, eddwinston <[email protected]> wrote:
>
> > > > > Hi,
>
> > > > > I am trying to make an ajax login, I am currently sending request to
> > > > > this url: [app]/default/user/login. But it has been fruitless. I just
> > > > > get a full page html markup and the user will not be logged in. Is
> > > > > there a way I can do it?
>
> > > > > Regards,
> > > > > Winston
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---