Buon giorno.
Ho una funzione che gestisce l'invio dei dati ad una seconda pagina che esegue l'INSERT.
Soltanto che vorrei ottimizzarla ma non so come fare.
Tutte quelle if, per esempio non posso essere ottimizzate?
Mi aiutate per favore?codice:function subInUppIstr(tip,id_istr,id_dett){ var morDal = $("#morDal").val(); var morAl = $("#morAl").val(); var salMor = $("#salMor").val(); var intDal = $("#intDal").val(); var intAl = $("#intAl").val(); var salInt = $("#salInt").val(); var impCre = $("#impCre").val(); var impDeb = $("#impDeb").val(); var impRim = $("#impRim").val(); var saldTot = $("#saldTot").val(); var morUtePrec = $("#morUtePrec").val(); var ImpCont = $("#ImpCont").val(); var numRat = $("#numRat").val(); if(morDal==undefined){ morDal = ''; } if(morAl==undefined){ morAl = ''; } if(salMor==undefined){ salMor = ''; } if(intDal==undefined){ intDal = ''; } if(intAl==undefined){ intAl = ''; } if(salInt==undefined){ salInt = ''; } if(impCre==undefined){ impCre = ''; } if(impDeb==undefined){ impDeb = ''; } if(impRim==undefined){ impRim = ''; } if(saldTot==undefined){ saldTot = ''; } if(morUtePrec==undefined){ morUtePrec = ''; } if(ImpCont==undefined){ ImpCont = ''; } if(numRat==undefined){ numRat = ''; } if(confirm("Aggiornare?")){/*ecc ecc*/} }