Welcome Guest, Not a member yet? Register   Sign In
easy ajax problem
#1

[eluser]mandril[/eluser]
Ok i get how to send the information so now i have a concrete problem.. please ignore the previous post.

I got this almost working with jQuery

My Controller: socio.php i have this method

Code:
function esta()
    {
        //this varible contains the array of existing users
        $existen_ci=array('123','456','789');
        //value got from the get metho
        $ci = $_POST['cedula'];
        //checking weather user exists or not in $existing_users array
        if (in_array($ci, $existen_ci))
        {
         echo "no";
        }
        else
        {
          echo "yes";
        }
    }


Ok this checks if a 'cedula' ( ID in english) is available or not.

In my JavaScript I have:

Code:
$(document).ready(function()
{
    $("#cedula").blur(function()
    {
        //remove all the class add the messagebox classes and start fading
        $("#msgbox").removeClass().addClass('messagebox').text('Verificando...').fadeIn("slow");
        //check the username exists or not from ajax
        $.post(base_url+"socio/esta/",{ cedula:$(this).val() } ,function(data)
        {
          if(data=='no') //if username not avaiable
          {
            $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
            {
              //add message and change the class of the box and start fading
              $(this).html('Cedula ya existe').addClass('messageboxerror').fadeTo(900,1);
            });        
          }
          else
          {
            $("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
            {
              //add message and change the class of the box and start fading
              $(this).html('Cedula libre para ser registrada').addClass('messageboxok').fadeTo(900,1);    
            });
          }

        });

    });
});


it should work i dont know whats going on =( it shows the message "Verificando..." (Verifying.. in english)

Anybody ?
#2

[eluser]mandril[/eluser]
I have a input textbox 'cedula' as name/id
#3

[eluser]mandril[/eluser]
please i really need help here ... nobody ? Sad




Theme © iAndrew 2016 - Forum software by © MyBB