Created
July 18, 2014 02:10
-
-
Save ckentq/684b2b887a70e4d5ab8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _new_id = 0; | |
// check only code | |
var currentTimer = 0; | |
var _code = ''; | |
checkIt = function(){ | |
if(_code == ''){ | |
$('#check_result').html('代碼不可為空白'); | |
}else{ | |
$('#waiting').show(); | |
$.post(_page_url+"/check_code", { code: _code}, | |
function(data){ | |
$('#waiting').hide(); | |
if(data['result']) { | |
$('#check_result').html('代碼可使用'); | |
}else{ | |
$('#check_result').html('代碼已存在'); | |
} | |
}, "json"); | |
} | |
} | |
$('#check_code').on('keyup', function(){ | |
_code = $(this).val(); | |
clearTimeout(currentTimer); | |
currentTimer = setTimeout("checkIt()", 800); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment