From e6bc6a29b958139ce9d4a2c9d0d05380b1cf6bf4 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 6 Jul 2011 00:34:24 +0200 Subject: [PATCH] only try to create the user once --- admin/js/users.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/admin/js/users.js b/admin/js/users.js index 1ef02c650a0..48f3b15e3b8 100644 --- a/admin/js/users.js +++ b/admin/js/users.js @@ -216,19 +216,25 @@ $(document).ready(function(){ // Create a new user $( "#createuserbutton" ) .click(function(){ - // Create the post data - var post = $( "#createuserdata" ).serialize(); - - // Ajax call - $.post( 'ajax/createuser.php', post, function(data){ - // If it says "success" then we are happy - if( data.status == "success" ){ - userCreated( data.data.username, data.data.groups ); - } - else{ - printError( data.data.message ); - } - }); + if(!$( "#createuserbutton" ).data('active')){ + $( "#createuserbutton" ).data('active',true); + + // Create the post data + var post = $( "#createuserdata" ).serialize(); + + // Ajax call + $.post( 'ajax/createuser.php', post, function(data){ + $( "#createuserbutton" ).data('active',false); + + // If it says "success" then we are happy + if( data.status == "success" ){ + userCreated( data.data.username, data.data.groups ); + } + else{ + printError( data.data.message ); + } + }); + } return false; }); -- 2.39.5