Epxlorer and AJAX

W

work.Yehuda

I'm Trying to write a chat width AJAX.
For so far it works fine in Firefox browser, The only problem I had is
width the Explorer.
The function setTimeOut doesn't seem to work well width AJAX. The
Explorer turn to the DB only ones.

did anyone ever bump into it?


Appendix

This is the function I used

var the_count = 0;
function users()
{
the_timeout = setTimeout('users();', 500);
sndReqOutput('' ,'users')

the_count += 1;

}
users();


This is the AJAX part (I didnt write it by myself):

function createRequestObject() {

var ro;

if (window.XMLHttpRequest){

try {

ro = new XMLHttpRequest();

} catch(e) {

//some kind of a weird mistake...you choose what you want to
do

ro = false;

}

} else if(window.ActiveXObject){

try{

ro = new ActiveXObject("Msxml2.HTMLHTTP");

} catch(e) {

try{

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

} catch(e) {

//don't know what to do...you choose

ro = false;

}

}

}

return ro;

}




var http = createRequestObject();

function sndReqOutput(action, page) {

http.open('get', page+'.php?action='+action,true);

http.onreadystatechange = output
http.send(null);

}



function output() {

if(http.readyState == 4){

var response = http.responseText;
document.getElementById('users').innerHTML=response




}

}

Thanking you in anticipation
 
S

shimmyshack

I'm Trying to write a chat width AJAX.
For so far it works fine in Firefox browser, The only problem I had is
width the Explorer.
The function setTimeOut doesn't seem to work well width AJAX. The
Explorer turn to the DB only ones.

did anyone ever bump into it?

Appendix

This is the function I used

var the_count = 0;
function users()
{
the_timeout = setTimeout('users();', 500);
sndReqOutput('' ,'users')

the_count += 1;

}
users();

This is the AJAX part (I didnt write it by myself):

function createRequestObject() {

var ro;

if (window.XMLHttpRequest){

try {

ro = new XMLHttpRequest();

} catch(e) {

//some kind of a weird mistake...you choose what you want to
do

ro = false;

}

} else if(window.ActiveXObject){

try{

ro = new ActiveXObject("Msxml2.HTMLHTTP");

} catch(e) {

try{

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

} catch(e) {

//don't know what to do...you choose

ro = false;

}

}

}

return ro;

}

var http = createRequestObject();

function sndReqOutput(action, page) {

http.open('get', page+'.php?action='+action,true);

http.onreadystatechange = output
http.send(null);

}

function output() {

if(http.readyState == 4){

var response = http.responseText;
document.getElementById('users').innerHTML=response

}

}

Thanking you in anticipation

your interval is very small, have you considered server load, having
long open connections with a "push" to the client is much more
efficient, unlike short open connections repeated often.
If you want a true chat application consider using jetty server.
 
W

work.Yehuda

your interval is very small, have you considered server load, having
long open connections with a "push" to the client is much more
efficient, unlike short open connections repeated often.
If you want a true chat application consider using jetty server.- Hide quoted text -

- Show quoted text -

I don't understand. :(
What do you mean by 'server load'?
What is 'Jetty Server'?
Do you mean using different language then JS and PHP?
I'm sorry. maybe it's because of my English (I'm an Israelian), Or
becuase I'm not familiar enough with javascript(I'm quite new ).
Please exlain to me

thank you
 
S

shimmyshack

I don't understand. :(
What do you mean by 'server load'?
What is 'Jetty Server'?
Do you mean using different language then JS and PHP?
I'm sorry. maybe it's because of my English (I'm an Israelian), Or
becuase I'm not familiar enough with javascript(I'm quite new ).
Please exlain to me

thank you- Hide quoted text -

- Show quoted text -

jetty server, please see:
http://sourceforge.net/project/showfiles.php?group_id=7322
there is an ajax chat application, try it and you will see the
difference. (when one of you clicks enter, the other sees the data
immediately)

server load - a request every 500ms? are you sure that your server can
respond that quickly before being asked again, then think there will
be two of you to chat, that's 4 requests a second. You are pushing at
the limit of what's possibly unless you are local, the data itself
will take time to travel from server<->browser making the time
interval too small in my opinion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top