使用ajax-php发送变量时出错

I try make a login using ajax, but when sending the variables to a php file arriv empty..

ajax:

  function enviar()
  {
    var ced=$("#cedula").val();
    var con=$("#contraseña").val();
    $.ajax({
      async:true,
      type: "POST",
      dataType: "html",
      contentType: "application/x-www-form-urlencoded",
      url:"sesion/index.php",
      data:{"cedula": ced,"contraseña": con},
      beforeSend:inicioEnvio,
      success:llegada,
      error:problemas
    }); 
      return false;
  }

php code:

 $operaciones=new operaciones();
    $operaciones->conexion();
    if($operaciones->verificar_login('usuario','USU_Cedula',
       'USU_Contraseña',$_POST['cedula'],
        $_POST['contraseña'], $result)== 1){codigo}

In PHP, try the following code... it should give you a dump off everything sent..

<?php
  echo "Request:<br /> ", print_r($_REQUEST,true), "<br />";
  echo "Get:<br /> ", print_r($_GET,true), "<br />";
  echo "Post:<br /> ", print_r($_POST,true), "<br />";
?>

Otherwise, the js looks fine at a glance. i would suggest the POST method of jquery though.

$.post( "sesion/index.php", { "cedula": ced,"contraseña": con }).done(function( data ) {
    alert( "Data Loaded: " + data );
});

Using post saves having to deal with some of the finer settings and should work in general use. PHP seems to play nicely with it as well..

The before event can be just a call in front of the post command and there is a error function as well that can be used.

EDIT

Sorry, miss read it i think. By the looks of it, your not getting a value from your js vars..

Try doing an alert straight after you obtain their value and try switching them in the post... try sending test strings to your PHP.

var ced=$("#cedula").val();
var con=$("#contraseña").val();
alert(ced);
alert(con);

/* Try this in your post */
data:{"cedula": "test1","contraseña": "test2"},
function verificar_login($tabla,$cedula_tab,$contra_tab,$txtCedula,$contraseña,&$result)
{
    $sql = "SELECT *FROM $tabla WHERE $cedula_tab = '$txtCedula' and $contra_tab = '$contraseña'
    and USU_Estado=1";
    $rec = mysql_query($sql);
    $count = 0; 
    while($row = mysql_fetch_object($rec))
    {
        $count++;
        $result = $row;
    }   
    if($count == 1)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}