diff options
| author | Scott Ostler <scottbot9000@gmail.com> | 2010-09-05 05:42:58 -0400 |
|---|---|---|
| committer | Scott Ostler <scottbot9000@gmail.com> | 2010-09-05 05:42:58 -0400 |
| commit | db00e681366adf1fc0739132c789818344d6a558 (patch) | |
| tree | e48fe61aefd6808823bc91e9e2eda16bcf40d66c /static/js | |
| parent | 1053ccd150312d84cda15a2fd9b5cf690a00af3b (diff) | |
add register page spinner, disabled inputs, and return to previous page instead of /
Diffstat (limited to 'static/js')
| -rwxr-xr-x | static/js/register.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/static/js/register.js b/static/js/register.js index 35fcc8a..c767e92 100755 --- a/static/js/register.js +++ b/static/js/register.js @@ -31,10 +31,15 @@ function submitRegistration() { if (typeof pageTracker !== 'undefined') { pageTracker._trackEvent('User', 'Register', nick); } - location.href = "/"; + if (window.history && history.length > 1) + history.go(-1); + else + location.href = '/'; }; var onError = function(resp) { + $('#register-spinner').hide(); + $('input').removeAttr('disabled'); var respText = resp.responseText ? resp.responseText.trim() : false; if (respText == 'NICK_TAKEN') { alert("That nick is already taken! Please choose another."); @@ -44,11 +49,12 @@ function submitRegistration() { alert("Unable to register!"); } }; - + $('input').attr('disabled', 'disabled'); + $('#register-spinner').show(); $.ajax({ type: 'POST', timeout: 5000, - url: 'submit-registration', + url: '/submit-registration', data: {'nick': nick, 'email': email, 'hash': hash }, cache: false, dataType: 'json', |
