javascript - [PHP-JQuery]: check if a form entry alreay exists in database without clicking on submit button -
i developing form in web page user supposed write tax code of person , system automatically checks database if person inserted tax code exists before clicking on submit button. here's jquery code of php page:
jquery("#form1").validate({ rules: { name: "required", surname: "required", ... <?php echo ' tax_code:{ remote: { url: "check_cf.php", type: "post", data: { tax_code: function() { return jquery( "#tax_code" ).val(); } } } }, '; ?> }, messages: { name: "insert client's name!", ... , <?php echo ' tax_code: { remote: "you have inserted person tax code", } '; ?> } });
and here check_cf.php
<?php $deep=""; include($deep."include/head.php"); $cfpost=$_post['tax_code']; $cliente_cf=$sistema->clienti->allclienti(" codice_fiscale='".$cfpost."' "); //echo $usernamepost; if(isset($cliente_cf[0]["id"])) echo json_encode(false); else echo json_encode(true); ?>
and nothing works...i don't know making mistake. all
Comments
Post a Comment