Buondi, ho un problemino che mi assilla da qualche giorno.
Spero in un vostro aiuto
.
Ho un tabella html con dati prelevati dal mio database. Uno dei campi di questa tabella viene aggiornato con una modifica in linea tramite ajax.
Tutto funziona al meglio, tranne la convalida dell'input.
Questo è il codice jquery:
codice:
jQuery(document).ready(function()
{
jQuery(".edit_tr").click(function()
{
var ID=jQuery(this).attr('id');
jQuery("#first_"+ID).hide();
jQuery("#first_input_"+ID).show();
}).change(function()
{
var ID=jQuery(this).attr('id');
var first=jQuery("#first_input_"+ID).val();
var dataString = 'id='+ ID +'&lottery='+first;
jQuery("#first_"+ID).html('<img src="images/loading.gif" />');
jQuery(".editbox").each(function() {
blottery=jQuery(this).val();
if((first.length>0) && (blottery<90))
{
jQuery.ajax({
type: "POST",
url: "scripts/table_edit.php",
data: dataString,
cache: false,
success: function(html)
{
jQuery("#first_"+ID).html(first);
}
});
}
else
{
alert('Errore');
}
});
});
jQuery(".editbox").mouseup(function()
{
return false
});
jQuery(document).mouseup(function()
{
jQuery(".editbox").hide();
jQuery(".text").show();
});
});
Il problema accade al momento della convalida del valore; se digito un numero maggiore di 90 mi viene segnalato l'errore ma l'aggiornamento va ugualmente a buon fine.
Come posso risolvere?