Ho trovato il seguente codice che ho manipolato. Quello che fa è verificare due campi (nome e cognome) se sono contemporaneamente presenti in un record di un db
codice:
<script>
$(document).ready(function () {
var validateCognome = $('#validateCognome');
var nom = $('#NOMEFields');
$('#COGNOMEFields').keyup(function () {
var t = this;
if (this.value != this.lastValue) {
if (this.timer) clearTimeout(this.timer);
validateCognome.removeClass('error').html('[img]imgs/loader.gif[/img] verifica...');
this.timer = setTimeout(function () {
$.ajax({
url: 'j_check.asp',
data: 'action=check_all&datavalue1=' + nom.value + '&datavalue2=' + t.value,
dataType: 'json',
type: 'post',
success: function (j) {
validateCognome.html(j.msg);
}
});
}, 200);
this.lastValue = this.value;
}
});
});
</script>
il problema è che mi da errore perché non mi ricava il valore del nome ($('#NOMEFields')) che risulta undefinied . Come mai?