I have a very simple AJAX application for test purpose.
Her it is:
one.asp --- the page with ajax function
Here is the two.asp which makes the desision:Code:<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script type="text/javascript"> var http = GetXmlHttpObject(); function GetXmlHttpObject() { var objXMLHttp=null if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") } return objXMLHttp } function getNewContent(value){ var url="two.asp"; url=url+"?q="+value; url=url+"&sid="+Math.random(); http.onreadystatechange = updateNewContent; http.open('GET',url,true); http.send(null); } function updateNewContent(){ if(http.readyState == 4){ document.getElementById('mySentence').innerHTML = http.responseText; } } </script> </head> <body> <form id="form1" name="form1" method="post" action=""> <select name="udar1" id="udar1" onchange="getNewContent(this.value)"> <option value='golova'>Golova</option> <option value='ruki'>Telo/Ruki</option> <option value='nogi'>Nogi</option> </select> </form> <div id="mySentence"> </div> </body> </html>
The problemm is that the page two.asp seems to be called only once, because it does not metter what have been selected from dropdown box, the display value will never change from "Nogi" to "ne Nogi" or otherwise.Code:<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% if request.QueryString("q")="nogi" then response.write "Nogi" else response.write "ne Nogi" end if %>
I am stuck with this pritty long. Any help will be appreciated.


Reply With Quote

Bookmarks