rev #6 poplogin, separate data success, error, redirect in javascript