it is because you create a new instance every time. to make this work,
you need to have a common variable reference to your request instance
that you reuse.
like:
var request = new Request({ link: 'cancel' ... });
request.send();
request.send();
request.send();
... will likely only result in the last one completing.
regards,
--
Dimitar Christoff
"JavaScript is to JAVA what hamster is to ham"
Personal blog: http://fragged.org/ - Twitter: @D_mitar
(function() {
var request = new Request.JSON({
url: '/echo',
link: 'cancel',
onRequest: function() {},
onComplete: function (json) {}
}
});
this.form_comment = function(id){
request.send(document.id(id));
}
})();
form_comment(div1);
form_comment(div1);
form_comment(div1);
... or
request.setOptions({
data: document.id(id)
});
etc - you get the idea.
sure. just store a private id that changes on calling the function and
reference that in a selector in the onComplete
(function() {
var disposeid, request = new Request.JSON({
url: '/echo',
link: 'cancel',
onRequest: function() {},
onComplete: function (json) {}
var form = document.id("form_" + disposeid);
form && form.dispose();
}
});
this.form_comment = function(id){
disposeid = id;
request.send(id);
}
})();
made a little change but is working with multiple requests in chrome.