On May 22, 2006, at 3:18 PM, [EMAIL PROTECTED] wrote:
Ok, this is what I have done:
function postJSONDoc(url, postVars) {
var req = getXMLHttpRequest();
req.open("POST", url, true);
req.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
var data = queryString(postVars);
var d = sendXMLHttpRequest(req, data);
// check if got a special reply from server
var serverMsgCallback = function(result) {
log(...)
}
d.addCallback(serverMsgCallback);
return d.addCallback(evalJSONRequest);
}
function test() {
var first = postJSONDoc('getFirst', {});
var snd = postJSONDoc('getSnd', {});
var list = new DeferredList([first, snd], false, false, true);
list.addCallback(function (resultList) {
if ( ! resultList[0][0] || ! resultList[1][0]) {
...
}
(The code is somewhat simplified)
It's probably failing because you're forgetting to return the result
from serverMsgCallback. Either that, or it's failing because of code
that you didn't provide in this example. It'd be much easier to tell
if you provided some code that's actually runnable.
-bob
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.54.160.18 with SMTP id i18mr197344wre;
Mon, 22 May 2006 09:04:55 -0700 (PDT)
Return-Path: <[EMAIL PROTECTED]>
Received: from redivi.com (redivi.com [64.207.133.54])
by mx.googlegroups.com with ESMTP id v23si1065075cwb.2006.05.22.09.04.54;
Mon, 22 May 2006 09:04:55 -0700 (PDT)
Received-SPF: pass (googlegroups.com: best guess record for domain of [EMAIL
PROTECTED] designates 64.207.133.54 as permitted sender)
Received: from [213.213.135.203] (helo=[192.168.0.114])
by redivi.com with esmtpsa (TLSv1:RC4-SHA:128)
(Exim 4.43)
id 1FiCto-0004pP-LF; Mon, 22 May 2006 09:04:54 -0700
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain
Message-Id: <[EMAIL PROTECTED]>
Cc: "MochiKit" <[email protected]>
From: Bob Ippolito <[EMAIL PROTECTED]>
Date: Mon, 22 May 2006 16:04:45 +0000
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
X-Mailer: Apple Mail (2.750)
X-SA-Exim-Connect-IP: 213.213.135.203
X-SA-Exim-Mail-From: [EMAIL PROTECTED]
Subject: Re: [mochikit] Re: Chained Deferreds
X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on redivi.com
X-Spam-Level:
X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00,TO_ADDRESS_EQ_REAL
autolearn=no version=3.0.2
X-SA-Exim-Version: 4.1+cvs (built Mon, 23 Aug 2004 08:44:05 -0700)
X-SA-Exim-Scanned: Yes (on redivi.com)
On May 22, 2006, at 3:18 PM, [EMAIL PROTECTED] wrote:
Ok, this is what I have done:
function postJSONDoc(url, postVars) {
var req = getXMLHttpRequest();
req.open("POST", url, true);
req.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
var data = queryString(postVars);
var d = sendXMLHttpRequest(req, data);
// check if got a special reply from server
var serverMsgCallback = function(result) {
log(...)
}
d.addCallback(serverMsgCallback);
return d.addCallback(evalJSONRequest);
}
function test() {
var first = postJSONDoc('getFirst', {});
var snd = postJSONDoc('getSnd', {});
var list = new DeferredList([first, snd], false, false, true);
list.addCallback(function (resultList) {
if ( ! resultList[0][0] || ! resultList[1][0]) {
...
}
(The code is somewhat simplified)
It's probably failing because you're forgetting to return the result
from serverMsgCallback. Either that, or it's failing because of code
that you didn't provide in this example. It'd be much easier to tell
if you provided some code that's actually runnable.
-bob
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---