dimanche 19 avril 2015

call a jsp page depending on selection from drop down

I have a dropdown menu. Depending on the selection i have to call different JSP. Here is the drop down :



this is banner.jsp :

<select id = "selectValue" onchange="loadInternationalDoc()">
<option value="domestic">Domestic (India)</option>
<option value = "international">International</option>
</select>


On selecting domestic i have to replace banner.jsp with default.jsp otherwise i have to replace it with internationalDefault.jsp. I am using JS code for doing this like this :



<script>
function loadInternationalDoc() {
var xmlhttp;
var selectionValue = document.getElementById('selectValue').value;
var url;
if(selectionValue == 'international') {
url="internationalDefault.jsp";
}
else {
var url = "default.jsp";
}

if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("fullwrapper").innerHTML=xmlhttp.responseText;
}
xmlhttp.open("GET", url, true);
xmlhttp.send();


}


But is is not working. In banner.jsp , i have kept ebverything inside the div "fullwrapper". I am a beginner. Any help will be appreciated


Aucun commentaire:

Enregistrer un commentaire