How to get intermidiate responses by AJAX?

Hi,I wanted to show intermidiate steps to user after calling the lotusscript agent by ajax.

I tried this by following way but it is showing all the data after finishing the running of the agent →

Client Side -




<input type=“button” onclick="window.document.forms[0].Submit.disabled=true;

var i;

var xmlHttp;

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

//xmlHttp.overrideMimeType(‘text/xml’);

xmlHttp.onreadystatechange=function() {

 if(xmlHttp.readyState==4 &amp;&amp; xmlHttp.status == 200)

{

	NodeList = xmlHttp.responseXML.getElementsByTagName(&quot;ResultText&quot;);		

	for (i=0; i&lt;NodeList.length; i++)

	{		

		var msg = NodeList[i].childNodes[0].nodeValue;		

		//msg = fnTrim(msg);

		objDiv = document.getElementById(&quot;DivAjaxResponse&quot;);

		objDiv.innerHTML = msg;		

	}					

}

	else if(xmlHttp.readyState==4 &amp;&amp; xmlHttp.status != 200) {     alert(&quot;error in AJAX return : &quot; + xmlHttp.status);}           		    	

}

xmlHttp.open("GET","/" + window.document.forms[0].DBPath.value + "/(agAjaxIntermediateProgress)?OpenAgent",true);

xmlHttp.send(null);

function fnTrim(strText) {

// this will get rid of leading spaces

while (strText.substring(0,1) == ' ') 

    strText = strText.substring(1, strText.length);



// this will get rid of trailing spaces 

while (strText.substring(strText.length-1,strText.length) == ' ')

    strText = strText.substring(0, strText.length-1);

return strText;

} // End Function fnTrim() " value=“Submit” id=“Submit”>


Server Side (LS Agent - “agAjaxIntermediateProgress”) -

Sub Initialize

Print {Content-Type: text/xml}	

Print {<?xml version="1.0" encoding="UTF-8" ?>}

Print {<HeaderElement>}

Print {<ResultText>}	

Print "Intialising...."

Print {</ResultText>}	



Sleep 2



Print {<ResultText>}	

Print "Step 1 completed."

Print {</ResultText>}	

Print {</HeaderElement>}

End Sub


Desired Result -

  1. Initialing…

  2. (Wait of 2 Seconds)

  3. Step 1 completed

Actual Result -

  1. (Wait of 2 Seconds)

  2. Initialing…

  3. Step 1 completed

Anybody please suggest how to get disired output?

Subject: How to get intermidiate responses by AJAX?

You’re print statements (server side) are buffered and send at once when the agent is finished.

Subject: RE: How to get intermidiate responses by AJAX?

Please suggest how to get desired output?

Subject: RE: How to get intermidiate responses by AJAX?

The “Processing…” notification should be initiated by the browser, not the server.

Subject: Still in search of solution to show ‘Intermidiate Progress’

Subject: RE: Still in search of solution to show ‘Intermidiate Progress’

What part of “you can’t do that” isn’t hitting home?

Subject: RE: Still in search of solution to show ‘Intermidiate Progress’

I have a lotusscript agent creating various number of documents. Actually I want to show the status to user, at client side, on the fly(by preogressbar if possible) after creating every type of document ( like -

       1. Process Intiated....           

       2. Doc1 created.

       Processing...

       3. Doc2 created.

       Processing...

       4. Doc3 created.

       Processing...

       5. Doc4 created.

       Processing...

       6. Doc5 created.

       Fianlizing process...

       Prpcess completed successfully.

       8. Redirecting to Homepage...

).

I tried this by AJAX (as written in initial post) but I am getting all the responses sent by print statement of agent, all at the end of execution.

However I want these responses immediately when they have sent by agent (not combined, at the end).

How to implement this?

Subject: RE: Still in search of solution to show ‘Intermidiate Progress’

You can’t within a single agent. Period. If you want individual replies for each document, you need to call individual agents for each document.

Subject: RE: Still in search of solution to show ‘Intermidiate Progress’

Calling agents one after another (just to show the intermidiate status); I think its not a feasible solution.

How to do it in a single agent making use of AJAX (or any other web2.0 stuff if any)?

Subject: RE: Still in search of solution to show ‘Intermidiate Progress’

Just how many times do you have to be told that it can’t be done before you start to believe people? You’ve even tested it yourself to prove it. How much more proof do you need?

Subject: RE: Still in search of solution to show ‘Intermidiate Progress’

It sounds like what you’re asking for is a servlet or web service. These are not the same as an agent.

Subject: RE: Still in search of solution to show ‘Intermidiate Progress’

Looks like you don’t trust into what Stan says … and right so: Why would you trust a guy known to the world as Mr. Notes Forum?

So I’ll step in and let you know the truth: You can’t do what you want to do the way you want to do it until Web 3.0 is released (still doesn’t work in the current Beta 3).