Hi,

Can someone give me suggestions. I am completely out of ideas now. The
ajax login I have been trying to do is beginning to drive me insane. I
am making the request to [app]/default/user/login and this how i
generated the url:
  URL(r=request,c='default', f='user', args='login',extension='json')

I also created a file called user.json but the a complete page markup
is being returned from the server.

In the user.json file, I have this in it:
    {{if user.is_logged_in():}}
    response.write(True)
    {{else:}}
    response.write(False)
    {{pass}}

Thanks
Winston


On Sep 11, 12:28 pm, eddwinston <[email protected]> wrote:
> Hi Jason,
>
> I did create a file and named it user.json then put in the code
> Massimo suggested but I still get the page markup. It was suppose to
> return json.
>
> On Sep 11, 6:24 am, Jason Brower <[email protected]> wrote:
>
> > If you looking for that it is in the manual.  And the examples.
> > I think you can create a page like generic.xml like in a new application
> > if you deleted one, just make it.
> > Then you just ask for the page with .xml at the end.
> > A new application has the framework for what I think your wanting to do.
> > And if I am not mistaken you have the manual, it talks about that in
> > great detail too.
> > Regards,
> > Jason Brower
>
> > On Thu, 2009-09-10 at 12:31 -0700, eddwinston wrote:
> > > Hi guys,
>
> > > Theloginnow works, the session is saved but the value returned from
> > > the server is still a full page html markup. How can I get either xml
> > > or json as a return value?
>
> > > Thanks
> > > Winston
>
> > > On Sep 10, 10:42 am, eddwinston <[email protected]> wrote:
> > > > Thanks a lot guys. I will try it when I get hands on my app again.
>
> > > > Regards,
> > > > Winston
>
> > > > On Sep 10, 9:28 am, "mr.freeze" <[email protected]> wrote:
>
> > > > > Try this. u is the url, i is the form index (set to 0 for a single
> > > > > form on the page), and t is the target for the response.
>
> > > > > function ajaxSubmit(u,i,t){
> > > > >     frm = jQuery("form:eq(" + i + ")");
> > > > >     query = 'undefined=' + i;
> > > > >     if (frm.length==1){query = frm.serialize();}
> > > > >     jQuery.ajax({type: "POST", url: u, data: query, success: function
> > > > > (msg) { if(t==':eval') eval(msg); else jQuery("#"+t).html(msg); } });
>
> > > > > }
>
> > > > > 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 theloginpage. 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 anajaxlogin, 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to