Salve,
sto costruendo unìapplicazione web e-commerce e nella sezione FAI ORDINE mi trovo di fronte al problema seguente:
quando aggiungo un nodo dopo aver premuto sul bottone ordina, quello che firefox mi restituisce è questo:
questo è il pezzo di codiceinteressato :Codice PHP:ORDINE EFFETTUATO CON SUCCESSO.
Codice ordine:27
quantita:[object Event]
prezzo totale:undefined
codice:function ordina() { var l=0; if (document.formFaiOrdine.pass.value.length == 0) { alert("Il campo password deve contenere almeno un carattere"); document.formFaiOrdine.pass.focus(); return; } while(l<i) { cod=articoli [l]; prezz=prezzi [l]; quan=quantita [l]; set(cod,prezz,quan); l++; } if (confirm("Confermare i dati inseriti ?")) { alert(quantita) ; --------->qui stampa un valore indefinito passw=document.getElementById("pass"); quantita=document.getElementById("quantita").value; totale=document.getElementById("totale"); objHTTP=XMLHttp(); if (objHTTP!=null) { var params=("menu=ordine&pass="+escape(passw)+"&qua="+escape(quantita)+"& totale="+escape(totale)); objHTTP.open("post", "GestionePOST.php", true); objHTTP.setRequestHeader("content-type", "application/x-www-form-urlencoded"); objHTTP.setRequestHeader("Content-length", params.length); objHTTP.onreadystatechange=ordeffett; objHTTP.send(params); ordeffett(quan,totale); objHTTP.setRequestHeader("connection", "close"); } } } function ordeffett(quantita,totale) { if (objHTTP.readyState == 4 ) { if (objHTTP.status == 200) { alert(quantita) ; --------->qui stampa un valore indefinito // creiamo un nuovo nodo di testo var ordine= objHTTP.responseText; frase = document.createTextNode("ORDINE EFFETTUATO CON SUCCESSO. Codice ordine:"+ordine+"\n quantita:"+quantita+"\n prezzo totale:"+totale); // poi lo attacchiamo al nodo di riferimento document.getElementById("content2").appendChild(frase); } else { alert('C\' è un problema con la rischiesta.'); } } } function set(cod,prezz,quan) { objHTTP = XMLHttp(); //apertura della connessione HTTP passw=document.getElementById("pass"); objHTTP.open("GET","GestioneGET.php?menu=assegnaOrdine&cod="+escape(cod)+"&prezzo="+escape(prezz)+"&quantita="+escape(quan), true); objHTTP.send(null); }

Rispondi quotando
