Welcome Guest, Not a member yet? Register   Sign In
Use AJAX to validate a field
#11

[eluser]xcristi[/eluser]
Hey man, thanks again.
After struggling these days with the new (for me) jQuery, I managed to get some results.

In my view there is something as:
Code:
$(document).ready(function(){
    $('#statiune').bind('blur', function(){
        $('#ajaxreply').text(
            $.ajax({
                type: 'POST',
                url: 'http://link/on/my/site',
                data: 'z=' + $('#statiune').val(),
                async: false,
            }).responseText
        );
        $('#ajaxreply').fadeOut(3000);
   });
});

where #statiune is ID for the field I need to check. I took its value (data: 'z=' + $('#statiune').val()) and POSTit to a function in my controller (indicated in URL). In that function take $this->input->post('z') and use it in a model function to do the work. The reply message is handled by #ajaxreply in my view.

I wrote these lines for the ones who can be interested in this kind of validation.

Thanks for you help.


Messages In This Thread
Use AJAX to validate a field - by El Forum - 09-05-2007, 12:13 AM
Use AJAX to validate a field - by El Forum - 09-05-2007, 01:15 AM
Use AJAX to validate a field - by El Forum - 09-05-2007, 02:05 AM
Use AJAX to validate a field - by El Forum - 09-05-2007, 02:40 AM
Use AJAX to validate a field - by El Forum - 09-05-2007, 02:50 AM
Use AJAX to validate a field - by El Forum - 09-05-2007, 03:24 AM
Use AJAX to validate a field - by El Forum - 09-05-2007, 04:53 AM
Use AJAX to validate a field - by El Forum - 09-05-2007, 05:17 AM
Use AJAX to validate a field - by El Forum - 09-05-2007, 06:37 AM
Use AJAX to validate a field - by El Forum - 09-05-2007, 07:13 AM
Use AJAX to validate a field - by El Forum - 09-06-2007, 06:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB