user types text in a text box, the text is sent to a php script with ajax. The response is used to populate a select menu. I am getting a xmlResponse is null error with some browsers.
Steps to recreate problem:
1. Goto Example page , in firefox/chrome.
2. type 's' in the text box
3. a menu should pop up, but instead I get xmlresponse is null (in firebug) .
The exact thing works on localhost on firefox/chrome but not when hosted. In Opera it works when hosted on localhost / internet.
Why ?
The xmlResponse -(copied from firebug)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<r><c><n>Sarvpriya Vihar</n><o>2</o></c><c><n>Sarvodaya Enclave</n><o>6</o></c></r>
The Code -
function handleKeyDownevent (e) {
mapimage.style.display = 'none' ;
e = e || window.event ;
if (xmlHttp) {
// try {
//xmlHttp.open('GET' , 'async.txt', true ) ;
var target= e.target || e.srcElement ;
var typed = target.value ;
if (typed != ""){
////console.log('sennding request') ;
xmlHttp.open('GET' , 'http://kutchbhi.x10.mx/ajax/choose.php?name='+typed, true ) ;
xmlHttp.onreadystatechange = handleServerResponse ;
xmlHttp.send(null) ;
}
else {
selectOption.innerHTML = "" ;
////console.log(e.srcElement.value + "is blank") ;
}
// }
// catch(e) {
// //console.log('could not connect to server') ;
// }
}
else {
////console.log('error') ;
}
}
function handleServerResponse() {
if (xmlHttp.readyState == 4 ) {
if ( xmlHttp.status == 200) {
// try {
var xmlResponse = xmlHttp.responseXML ;
var rootNode = xmlResponse.documentElement ;