[eluser]jesusruiz[/eluser]
Hello everyone and thanks for reading this message.
I have a problem that can not find reason to not work.
I am creating a validation for a user registration form with CodeIgniter, and I have a javascript file with this code:
Code:
$(document).ready(function(){
$('#username').bind('blur', function(){
var username = $(this).val();
var datos = {
field_username: username
};
$.ajax({
url: "users/username_check_ajax",
type: 'post',
data: datos,
success: function(msg){
alert(msg);
}
});
});
});
The only thing that makes this code is showing a warning screen with a message, when the user completes the 'field_username' (username in DB), which of course is a field that I have defined.
The method code of username_check_ajax is as follows:
Code:
function username_check_ajax()
{
echo $this->input->post('field_username');
}
As you can see nothing special, but the problem is that to check the result, the screen shows the alert, but does not appear the text of the function username_check_ajax.
I tried a thousand things, but can not get any satisfactory results.
Of course, other codes in the method username_check_ajax, such as the following, also shows me the text message alert:
Code:
function username_check_ajax()
{
echo "Hello World";
}
Does anyone have any idea where is the bug in my code?. THANKS.