rtrethewey;1249143 wrote:My point was that you can't do it with just HTML. You need software of some kind. Whether its ASP, PHP, Perl, Ruby, Java, or JavaScript does not matter. It's probably best to do this in JavaScript and AJAX to keep the original page loaded in the user's browser, but it all depends on which tools you know how to use.
Many thanks
I'm trying to do it using javascitp + ajax, but i have only one problem at moment... When i press the "submit" button, it retrieve me Error HTTP 404.0 - Not Found
This is the html with javascript and ajax
<html>
<head>
<title>Cerca Ragione Sociale</title>
<style type="text/css">
</style>
</head>
<body>
<form method="GET" action="prova()">
<label>Inserisci ragione sociale</label>
<input name="chiave"/>
<label>
<input type="submit"/>
</form>
<p>Results: <span id="txtHint"></span></p>
<SCRIPT LANGUAGE="JavaScript">
</SCRIPT>
<script> <!--Ajax-->
function assegnaXMLHttpRequest()
{
var XHR = null // variabile di ritorno, nulla di default
var browserUtente = navigator.userAgent.toUpperCase(); // informazioni sul nome del browser
// browser standard con supporto nativo non importa il tipo di browser
if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
XHR = new XMLHttpRequest();
// browser Internet Explorer, รจ necessario filtrare la versione 4
else if( window.ActiveXObject && browserUtente.indexOf("MSIE 4") < 0)
{
// la versione 6 di IE ha un nome differente per il tipo di oggetto ActiveX
if(browserUtente.indexOf("MSIE 5") < 0)
XHR = new ActiveXObject("Msxml2.XMLHTTP");
// le versioni 5 e 5.5 invece sfruttano lo stesso nome
else
XHR = new ActiveXObject("Microsoft.XMLHTTP");
}
return XHR;
}
function prova()
{
var str="a"
var xmlhttp=assegnaXMLHttpRequest()
xmlhttp.open("GET","cerca_ragione_sociale.asp?q="+str,true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{document.getElementById("txtHint").innerHTML=xmlhttp.responseText;}
}
}
</script>
</body>
</html>
and this is the server side asp code
<%
response.buffer = true
Response.Expires = 0
Response.AddHeader "PRAGMA", "NO-CACHE"
Response.CacheControl = "PRIVATE"
chiave="a"
dim conn, strConn
strConn = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " &_
Server.MapPath("md-database\ME.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open StrConn
sqlRagioneSociale = "SELECT * FROM Anagrafiche Where RagioneSociale like'%" & chiave & "%'"
Set rsRagioneSociale = Server.CreateObject("ADODB.Recordset")
rsRagioneSociale.Open sqlRagioneSociale, conn, 1,3
Response.write("<div id='lista'>")
do until rsRagioneSociale.EOF = true
Response.write(rsRagioneSociale("RagioneSociale"))
Response.write("<br>")
RsRagioneSociale.MoveNext
loop
Response.write("</div>")
%>
Where i wrong?