简体   繁体   中英

How do I optimize my login process?

I've tried two ways.

(1) User enters info->Ajax call to verify credentials->From server side send a header, capture it at the client and write it using document.write().

(2) User enter info->Ajax call to verify credentials->Server side completes ->Back on client side call the new page using window.location.href.

"One" partly works except it feels like a hack and also the onload function is not called(so this part is broken) when I used document.write() to send the whole page.

"Two" works except it is inefficient, when I finish verifying credentials, at the server, wrather then sending the correct page immediately, control is passed back to the client(javascript) which then requests the page back from the server, ie two round trips.

可以使用header()完成服务器端刷新。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM