PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_AJAX » Bug #8257

Hangs up the Browser After AJAX request Untill response comes back

Details

Submitted2006-07-20 09:48 UTC
Fromvikrantl at clariontechnologies dot co dot in
StatusBogus
PackageHTML_AJAX
PHP Version4.3.8
OSLinux Fedora
Roadmaps(Not assigned)

Comments

[2006-07-20 09:48 UTC] vikrantl at clariontechnologies dot co dot in

Description:
------------
I am facing one major problem,
I am creating a chat application where I am sending an Ajax request recursively for every 5 seconds.

At Each 5th sec. when request is being send, The Text area from where user post the message gets hang untill response comes back on the page.

Do anybody has the solution for this problem, so my users can experience realtime chat application.

Thanks,

Vikrant.

Test script:
---------------
function fnDisplayMessage(strName,intUserId,intLinkQuesId,strLinkTopic)
{
var objTemp1=new Object();
var objEvents=new Object();
var arrMsgs=hdlChatHandler.fnDisplayMsgs(intQuesId,strName,intUserId,objTemp1,objMessage,objEvents,strFlagMsgFrom,intResetFlag);

//get the time of latest ajax request
var strCurDate = new Date();
dblLastRequestTime = strCurDate.getSeconds();

// We need to call the Topic listing function after 10 seconds so when first time the AJAX call is made
// the get topic listing function is called. Then set the strFlagMsgFrom to 'client' means when next time the
// AJAX Call is made the topic listing function is not get called.
if(strFlagMsgFrom=='provider')
{
strFlagMsgFrom='client';
}else
{
strFlagMsgFrom='provider';
}

//Empty Message Object after insertion of messages into the database
objMessage['prouserid']=new Array();
objMessage['message']=new Array();
objMessage['timestamp']=new Array();
intMsgCnt=0;

intResetFlag = 0;

//Store Topic Listing array into the Javascript array
for(var keyvar in arrMsgs)
{
for(var keyvar1 in arrMsgs[keyvar])
{
if(keyvar1=='topic_listing')
{
var arrTopicDetails=arrMsgs[keyvar][keyvar1];
break;
}
}
}
//Store Topic IDs array for new messages into the another Javascript array
for(var keyvar in arrMsgs)
{
for(var keyvar1 in arrMsgs[keyvar])
{
if(keyvar1=='newmsg_topics')
{
var arrNewMsgTopics=arrMsgs[keyvar][keyvar1];
break;
}
}
}
fnCheckForNewTopic(intJyveUserId,arrTopicDetails,arrNewMsgTopics,intLinkQuesId,strLinkTopic)

// Call to a Create Chat Template Function
fnCreateChatTemplate(arrMsgs);
//alert("Message dispaly Updates");

//Call this function after every 5 seconds
hdlRequestSent = setTimeout('fnDisplayMessage(strSkypename,intJyveUserId,intLinkQuesId,strLinkTopic)',5000);
}

Expected result:
----------------
I dont want my TextArea /TextBox gets hangup untill AJAX response comes on the page.

Actual result:
--------------
Textarea/Textbox rather page gets hangup untill server responds back to AJAX request.

[2006-07-20 15:20 UTC] lyaish at php dot net

I don't think your code shows whether you're making a
synchronous or asynchronous ajax call. A synchronous call will
lock up the browser, this is normal behavior. Take a look at
the examples at http://bluga.net/projects/HTML_AJAX/examples/
to see how sync and async calls differ.

[2006-08-09 05:37 UTC] jeichorn at php dot net

Im assuming this is using a sync call when async is needed, closing