onchange="loadDDLfirst()"
The loadDDLfirst() file is written in a javascript file(i.e, name of the javascript file is ajaxjs.js)
//////////////---Code of ajaxjs.js----///////////////////////
var xmlhttp;
var nm;
function loadDDLfirst()
{
/*To save the name of the District*/
var w = document.
var selected_text = document.
document.
/////-----------------------------/////
var districtID;
parameterValue = document.getElementById("ddlFirst").value;
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Your browser does not support Ajax HTTP");
return;
}
//////////////---End of code of ajaxjs.js----///////////////////////
/* Actually the drop down list is generated at another webpage consisting on the dropdown list. And each time a random no. is added with the url to make identity of the request*/
url ="<webpageurl>?
xmlhttp.onreadystatechange=getValues;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function getValues()
{
if (xmlhttp.readyState==4)
{
document.getElementById("load_ddl2ND").innerHTML=xmlhttp.responseText;
}
}
load_ddl2ND is the id of the form element where the webpageurl.jsp page will be showed. The webpageurl.jsp contains the code to create the dropdownlist.
<%
///Code to load simple dropdownlist as in normal jsp
%>
No comments:
Post a Comment