<script type="text/javascript">
$('#checkstatus').bind('click', function() {
var username=$('#username').val();
if(username!='') {
$.ajax({
url: 'index.php?route=account/register/usernamestatus&username=' username,
type: 'post',
data: $('.form input[type='text']'),
dataType: 'json',
success: function(json) {
$('.success, .warning, .attention, information, .error').remove();
if(json['success']) {
$('#notification').html('<div class="success" style="display: none;">username avliable for use <img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.success').fadeIn('slow');
} else {
$('#notification').html('<div class="warning" style="display: none;"> Username aleady in use <img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.warning').fadeIn('slow');
}
}
});
} else {
$('#notification').html('<div class="warning" style="display: none;"> Please fill username <img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.warning').fadeIn('slow');
}
});
</script>
คือต้องการเพื่มเงื่นไขถ้าใส่อักษร น้อยกว่า5 และมากกว่า 32 ให้แสดงerror
