On 08/02/2012 15:47, Sid-ahmed D wrote:
Hello world,
I need your help, please ^^
3 requests are started by function "form_comment(x)" but just one can
running.
I try to use link cancel but doesn't work.
"div" name is a primordial element and it can change depending on page.
form_comment(div1);
form_comment(div1);
form_comment(div1);
form_comment = function(id){
new Request.JSON({
url: '/echo',
data: $(id),
link: 'cancel',
onRequest: function() {},
onComplete: function (json) {}
}
}).send();
};
Could you please help me ?
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