safetyweek Posted December 3, 2010 Share Posted December 3, 2010 Javascript and ASPHi everyone, I need your help.I need execute ASP query using the value of variable "codice".I read in the index.asp the value of variable "codice" with: <td id="codice_value"></td> I try this, but the value get in a hidden form field value is null.Index.asp: <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <script type="text/javascript" language="javascript"> var estrai; function cerca(codice) { document.getElementById('codice_value').innerHTML = codice; if (window.XMLHttpRequest) { estrai = new XMLHttpRequest(); } else if (window.ActiveXObject) { estrai = new ActiveXObject("Microsoft.XMLHTTP"); } if (estrai) { estrai.onreadystatechange = ricevi; estrai.open("GET", "estrai.asp?codice="+codice, true); estrai.send(null); } } function ricevi() { var xxx; if (estrai.readyState == 4) { xxx=estrai.responseText; document.getElementById('xxx').innerHTML = xxx; } } </script> </head> <body> <form method="post" action="" name="form"> <table> <tr> <td> <select name="codice" onChange="cerca(this.value);"> <option value="0">Seleziona</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> </td> </tr> <tr> <td id="xxx">This is the page estrai.asp... </td> </tr><tr> <td id="codice_value">This is page index.asp... </td> </tr></table> <input type="hidden" value=document.form.codice.value name="codice_value" /> </form> <br> <% SQL = " SELECT SQL_CALC_FOUND_ROWS * FROM " SQL = SQL & " tbl " SQL = SQL & " WHERE 1 " SQL = SQL & " AND ID = " & Request.Form("codice_value") & " " response.write SQL%> </body> </html> estrai.asp <% stringa = request.querystring("codice") response.write stringa & "<br>"%> Can you help me? Can someone help me?Thanks in advance. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 7, 2010 Share Posted December 7, 2010 <input type="hidden" value=document.form.codice.valueThat's not going to work, you're going to need to change the function to set the value of that element manually. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.