これが私のコードです:
function validateField(field, input) {
if (field && input) {
$.ajax({
type: 'POST',
url: '<?php echo site_url("ajax/verify"); ?>',
dataType: 'json',
data: { 'field' : field, 'input' : input},
success: function(result) {
var available = result.available;
if (available == 1) {
// return true (for the entire function);
}
}
});
}
return false;
}