Well, AJAX is s true implementation of JavaScript. The JSP will come into play when you output the server-side code. Sometime like the follow should help you out!
Code:<script type="text/javascript"> function chkDropDown(obj, url){ var xmlHTTP; try{xmlHTTP = new XMLHttpRequest();} catch(e){ try{xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");} catch(e){ try{xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");} catch(e){ alert("Your browser does not support AJAX!"); return false; } } } xmlHTTP.open('GET', url, true); xmlHTTP.send(null); xmlHTTP.onreadystatechange = function(){ if(xmlHTTP.readyState == 4){ populateList(obj, xmlHTTP.responseText); } } } function popuplateList(obj, results){ obj.length = 0; var theOptions = results.split(','); for(i = 0; i < theOptions.length; i++) { obj.options[i] = new Option(theOptions[i], theOptions[i]); } } </script> <select name="whatever" onchange="chkDropDown(this, 'path/to/file.jsp')">




Reply With Quote