I'm using CodeIgniter to create a registration form, and I am using AJAX to check if the e-mail address entered has already been used, but every time I check, I get the error 'ReferenceError: finishedAjax is not defined' This is my code:
<script type='text/javascript'>
$(document).ready(function() {
$('#Loading').hide();
$('#email_address').blur(function () {
var a = $("#email_address").val();
var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;
if(filter.test(a)) {
$('#Loading').show();
$.post("check_email_availablity", {
email: $('#email_address').val()
}, function(response) {
$('#Loading').hide();
setTimeout("finishedAjax('Loading', '"+escape(response)+"')",400);
});
return false;
}
});
function finishedAjax(id, response) {
$('#'+id).html(unescape(response));
$('#'+id).fadeIn();
}
});
</script>