akgalp
October 20th, 2005, 12:44 AM
hello all
i was experimenting some javascript as shown below
1.asp
<%
rec = "select count(*) from error_log "
set rs_rec = session("conn").execute(rec)
Response.Write ("var cnt="&rs_rec(0)&";")
rs_rec.close
set rs_rec=nothing
rec = "select id from error_log "
set rs_rec = session("conn").execute(rec)
while not rs_rec.eof
str = str & rs_rec(0) & ","
rs_rec.movenext
wend
Response.Write ("var recs='"&str&"';")
rs_rec.close
set rs_rec=nothing
%>
display();
function display()
{
var i;
var sel1=document.getElementById("select1");
sel1.options.length=0;
var rec = recs.split(",");
for(i=0 ; i < rec.length ; i++)
{
sel1.options[i] = new Option(rec[i],rec[i],false,false);
}
}
test.asp
<%@language=vbscript%>
<HTML>
<HEAD>
</HEAD>
<script language='javascript'>
function fill_list()
{
var tab = document.createElement('script');
tab.setAttribute('language','javascript');
tab.setAttribute('id','scr1');
tab.setAttribute('src','./1.asp');
document.getElementsByTagName('body')[0].appendChild(tab);
}
</script>
<BODY>
<%
set session("conn")=server.CreateObject("ADODB.connection")
session("conn").connectionstring="DSN=testdata;UID=test;pwd=test"
session("conn").open
%>
<SELECT style="WIDTH: 181px; HEIGHT: 361px" size=2 id='select1' name='select1'>
<OPTION></OPTION>
</SELECT>
<INPUT id='button1' onclick='javascript:fill_list()' type='button' value='click' name='button1'>
</body>
</html>
what i was trying to do is to fetch an asp file from the server dynamicaly , without refreshing the client side screen..
ie the test.asp will display a listbox and a button at the client side. when the button is clicked it loads 1.asp from server using javascript DOM manipulation. It works for the first time only . afterwards the same data will be presented even if the data in the database changes.. How to force the browser to reload 1.asp from server
thanks
akg
i was experimenting some javascript as shown below
1.asp
<%
rec = "select count(*) from error_log "
set rs_rec = session("conn").execute(rec)
Response.Write ("var cnt="&rs_rec(0)&";")
rs_rec.close
set rs_rec=nothing
rec = "select id from error_log "
set rs_rec = session("conn").execute(rec)
while not rs_rec.eof
str = str & rs_rec(0) & ","
rs_rec.movenext
wend
Response.Write ("var recs='"&str&"';")
rs_rec.close
set rs_rec=nothing
%>
display();
function display()
{
var i;
var sel1=document.getElementById("select1");
sel1.options.length=0;
var rec = recs.split(",");
for(i=0 ; i < rec.length ; i++)
{
sel1.options[i] = new Option(rec[i],rec[i],false,false);
}
}
test.asp
<%@language=vbscript%>
<HTML>
<HEAD>
</HEAD>
<script language='javascript'>
function fill_list()
{
var tab = document.createElement('script');
tab.setAttribute('language','javascript');
tab.setAttribute('id','scr1');
tab.setAttribute('src','./1.asp');
document.getElementsByTagName('body')[0].appendChild(tab);
}
</script>
<BODY>
<%
set session("conn")=server.CreateObject("ADODB.connection")
session("conn").connectionstring="DSN=testdata;UID=test;pwd=test"
session("conn").open
%>
<SELECT style="WIDTH: 181px; HEIGHT: 361px" size=2 id='select1' name='select1'>
<OPTION></OPTION>
</SELECT>
<INPUT id='button1' onclick='javascript:fill_list()' type='button' value='click' name='button1'>
</body>
</html>
what i was trying to do is to fetch an asp file from the server dynamicaly , without refreshing the client side screen..
ie the test.asp will display a listbox and a button at the client side. when the button is clicked it loads 1.asp from server using javascript DOM manipulation. It works for the first time only . afterwards the same data will be presented even if the data in the database changes.. How to force the browser to reload 1.asp from server
thanks
akg