PDA

View Full Version : standard submit vs. ajax in login form



dolittle
9 Mar 2009, 9:20 AM
Hi,

I have a login page with a login form
Is there any difference between submitting the login form with xhr and standard submit?

- When submitting with xhr the server will authenticate the user and respond with json and the client will redirect himself to the root page.

- When using standard submit, the server will authenticate the user and redirect him to the root page.

Does the xhr waste an http call or is there another critical difference?

Thanks

9 Mar 2009, 9:28 AM
There is merit to using AJAX vs standard submit.

AJAX will not apply a page refresh if the login info is incorrect. If it is correct, then yes, two calls will be made.

That said, why are you using Ext JS for a login form? Is the rest of your application written in Ext JS?

dolittle
9 Mar 2009, 9:42 AM
There is merit to using AJAX vs standard submit.

AJAX will not apply a page refresh if the login info is incorrect. If it is correct, then yes, two calls will be made.

Users don't get their username/password wrong too often and when they do I can direct them to another page with ajax form submit.

All I'm asking if ajax form submit + client side redirect and standard form submit + server side redirect makes the same number of http requests.


That said, why are you using Ext JS for a login form? Is the rest of your application written in Ext JS?
I'm using YUI, Dojo, Jquery and FLASH in my application but EXT JS only in the login form.
Why are you asking this ridiculous question?

tryanDLS
9 Mar 2009, 9:49 AM
That said, why are you using Ext JS for a login form? Is the rest of your application written in Ext JS?
I'm using YUI, Dojo, Jquery and FLASH in my application but EXT JS only in the login form.
Why are you asking this ridiculous question?

Interesting, given your response, I think that the Jay's question isn't the 'ridiculous' thing here. Why would you possible want to mix all those frameworks in a single app. Do you really want to debug all the cross library interaction problems? I'm certainly not advocating using YUI/Dojo/Jquery in place of Ext, but what can you possibly gain by adding Ext to that mix, just to do a login form? Are you really going to add the overhead of another library download, just to do this?

9 Mar 2009, 9:49 AM
The number of HTTP calls is one if you're doing a successful standard submit.

I'm sorry if you feel like it's a ridiculous question. I am asking because Ext JS is waaaaaaaaaay too large just for a login form! Especially if you're just using it to stylize a form.

Wow, using All of those frameworks?? Are you hosting an internet or intranet app?

mjlecomte
9 Mar 2009, 10:11 AM
There's another tact I have seen some take which is to not redirect on login when using the ajax approach. Just stay on that page, destroy/hide the login form, and off you go. I'm not taking any sides on which one is better, just pointing out another approach I've seen used.

dolittle
9 Mar 2009, 10:25 AM
There's another tact I have seen some take which is to not redirect on login when using the ajax approach. Just stay on that page, destroy/hide the login form, and off you go. I'm not taking any sides on which one is better, just pointing out another approach I've seen used.

That's an interesting idea. Maybe it is possible to build the app in the background while submiting the login form to make a better and faster user experience.

9 Mar 2009, 11:08 AM
it certainly plays to the idea of 'web 2.0'. none the less, adding that much JS bloat is a bad idea and would be considered poor design by many "experts" in the field (which i do not claim to be).

dj
9 Mar 2009, 11:20 AM
Also have a look at this thread: http://extjs.com/forum/showthread.php?t=60807
If you want to use the password remembering feature of the browsers you need to use standard submit.