AJAX problem with FIREFOX
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, October 24, 2007 05:45 AM

Hi, I have the following source - (this is the html) function createRequestObject() { var req; if(window.XMLHttpRequest){ req = new XMLHttpRequest(); } else if(window.ActiveXObject) { req = new ActiveXObject("Msxml2.XMLHTTP"); if (! req){ req = new ActiveXObject("Microsoft.XMLHTTP"); } } else { alert('#?+*!'); } return req; } var http = createRequestObject(); function doThis(flag) { http.open("get", "search.php?flag="+flag); http.onr   More>>

Hi,

I have the following source -



(this is the html)



function createRequestObject() {

var req;

if(window.XMLHttpRequest){

req = new XMLHttpRequest();

} else if(window.ActiveXObject) {

req = new ActiveXObject("Msxml2.XMLHTTP");

if (! req){

req = new ActiveXObject("Microsoft.XMLHTTP");

}

}

else {

alert('#?+*!');

}

return req;

}

var http = createRequestObject();

function doThis(flag) {

http.open("get", "search.php?flag="+flag);

http.onreadystatechange = handleResponse_doThis;

http.send(null);



function handleResponse_doThis() {

if(http.readyState == 4 && http.status == 200){

var response = http.responseText;

if(response) {

list value1

list value2

list value3

....

}

}

}



(this is in js file)


It is quite simple ajax example - when key is pressed - k for instance - the list of values starting with 'k' appear in a div. It is working ok if I press always normal characters(a-z for instance). But if I press '%' nothing happens. And here comes the funny(for me) part - if I just switch to other Firefox browser on my window and then come back to the search page, I see that '%' worked out - I see all words displayed in the div. Why this happens only when I switch to other browser window and then switch back? It seems that some refreshing is delayed or triggered by switch to other browser window? And also strange for me - this works perfectly in IE - by typing '%' list of all elements is displayed. That puts me in mind that XMLHttpRequest
make something, but I can't find it out.
Any ideas and help?



Thanks in advance.

   <<Less
About | Sitemap | Contact