[jquery.validate] remote problem
hi everybody,
i've got a problem with the validate plugin...
i can't make it work the remote option (everything else works quite good).
here's the .js code
$().ready(function() { // validate signup form on keyup and submit $("#form_esecuzione").validate({ rules: { id: { required: true, minlength: 4, maxlength: 15, remote: "n_perizia.php" } messages: { id: { required: "Campo Obbligatorio", remote: jQuery.format("{0} già utilizzato"), minlength: "Minimo 4 simboli", maxlength: "Massimo 15 simboli" } }); });
and here's the page called by remote:
<?php session_start(); if(!isset($_SESSION['myusername']) or $_SESSION['stato'!='admin'){ $_SESSION['link']="../esecuzioni/elenco_perizie.php"; header("location: ../main_login.php"); } else{ include("../lib/db_tool.inc.php"); include("../lib/functions.inc.php"); db_connect(); $numero=string_escape($_REQUEST['id']); $valid='true'; $sql="SELECT * FROM esecuzione WHERE n_perizia='". $numero ."';"; $result=mysql_query($sql); if(mysql_num_rows($result)!=0) $valid='"Esiste già una esecuzione con questo numero"'; return $valid; ?>
where is the problem?