Hi guys, The login now 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 <eddwins...@gmail.com> 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" <nat...@freezable.com> 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 <eddwins...@gmail.com> 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 <mdipie...@cs.depaul.edu> 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 <eddwins...@gmail.com> 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 <mdipie...@cs.depaul.edu> wrote: > > > > > > > show us the code > > > > > > > On Sep 9, 10:21 pm, eddwinston <eddwins...@gmail.com> 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 web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---