Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

when I am running my site in my system where i have put my war file, that time i am getting all city according to the state but when I am accessing my sites through URL from other system that time my code is not working .

Here below is my code please have a look and help me ,

Jsp
<html:select property="stID" styleClass="textbox" önchange="collegemasterURL('collegemaster.do?method=city&stID='+ this.value);">



Ajex File :

JavaScript
function collegemasterURL(url) {
	
	if (typeof XMLHttpRequest != "undefined"){
        xmlHttp= new XMLHttpRequest();
        }
      else if (window.ActiveXObject){
        xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
        }
      if (xmlHttp==null){
      alert("Browser does not support XMLHTTP Request") ;
      return;
      } 
      xmlHttp.onreadystatechange = processStateChange;
      xmlHttp.open("GET", url, true);
      xmlHttp.send(null);



function processStateChange() {
	if (req.readyState == 4) { // Complete
		if (req.status == 200) { // OK response
			
			var returnElements = req.responseText.split("||");
			//Process each of the elements 	
			for ( var i = 0; i < returnElements.length; i++) {
				if (returnElements[i] != "") {
					valueLabelPair = returnElements[i].split(";");
					//alert(valueLabelPair[1]+''+ valueLabelPair[0]);
					document.getElementById('cntID').options.length = returnElements.length;
					document.getElementById('cntID').options[i] = new Option(
							valueLabelPair[1], valueLabelPair[0]);

				}
			}
		} else {
			alert("Problem: " + req.statusText);
		}
	}
}
Posted
Updated 15-Feb-12 22:02pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900