Hi Arnar -- Thx for your response: Yes, as you mentioned
getLoginStatus was calling right way and I was keep increasing and end
up with 5000. After modifying the statement to
MochiKit.Async.callLater(5000, getLoginStatus, token) , it solved
issues. Also I made another sample test script, which works exactly
the way I want, but still I'm stuck in this script, for some reason I
couldn't able to call recursively. I'm sure I'll figure it out, so thx
again for your response.
--
Bala
On Feb 14, 7:31 pm, "Arnar Birgisson" <[EMAIL PROTECTED]> wrote:
> On 2/14/07, jsJava <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hell all:
>
> Hello there. What is your name?
>
> > I'm making a doSimpleXMLHttpRequest call, if the result is wait, I've
> > to call this again, until success. But I understand once call is made,
> > am not able to make the call again. But how to achieve this? Pls let
> > me know. Thx.
>
> Sure you can make another call.. see below.
>
> > Here is my code:
>
> > var getLoginStatus = function(token) {
> > var doExec = function (req) {
> > xml = req.responseXML;
> > var statusNode = xml.getElementsByTagName('status')[0];
> > var status = parseInt(statusNode.childNodes[0].nodeValue);
>
> > if(status == 2) { // login success
> > // do success
> > } else if(status == 1) { // still processing
> > MochiKit.Async.callLater(5000, getLoginStatus(token)); //
> > call again
>
> There is an error here, probably two, first you need to do
>
> MochiKit.Async.callLater(5000, getLoginStatus, token)
>
> otherwise getLoginStatus gets called right away even before callLater is
> called.
>
> Second.. the time parameter is in seconds and not milliseconds - I'm
> pretty sure you don't want to wait 5000 seconds which constitutes the
> length of a slightly short movie :o) -- So, if you really want 5
> seconds, this is what you want:
>
> MochiKit.Async.callLater(5, getLoginStatus, token)
>
> Seehttp://mochikit.com/doc/html/MochiKit/Async.html#fn-calllater.
>
> > }
> > };
>
> > var doError = function () {
> > };
>
> > var res = MochiKit.Async.doSimpleXMLHttpRequest(url);
> > res.addCallbacks(doExec,doError);
> > };
>
> Arnar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---