[Moo] Re: reduce the number of AJAX requests

2010-08-02 Thread jiggliemon
FMI, must one include the first set of parentheses to create a closure? An old book I was reading said that it's just extra sugar. function(){ ...stuff... }(); Is just the same. They say. -chase On Aug 2, 6:09 pm, Fábio M. Costa wrote: > It creates a closure, so the variables you create ins

Re: [Moo] Re: reduce the number of AJAX requests

2010-08-02 Thread Fábio M . Costa
It creates a closure, so the variables you create inside it wont be global variables. It's basically to avoid creating global variables cause maybe you can overwrite something you had before and stuff like that. It's safer. -- Fábio Miranda Costa On Mon, Aug 2, 2010 at 11:00 AM, Sid-ahmed D wro

[Moo] Re: reduce the number of AJAX requests

2010-08-02 Thread Sid-ahmed D
Perfect, it's working now. Thank you. just to understand. What does the parentheses in your example ? reduced to a function? ( fu)(); On 2 août, 15:48, Fábio M. Costa wrote: > Yes you can, look: > > http://jsfiddle.net/6UqAP/10/ > > @Dimitar Christoff: > > You can create a request at each

Re: [Moo] Re: reduce the number of AJAX requests

2010-08-02 Thread Fábio M . Costa
Yes you can, look: http://jsfiddle.net/6UqAP/10/ @Dimitar Christoff: You can create a request at each click but its not the correct way. This way you are being inefficient by creating a request at each click. You dont need to create a request object at each click, just send a request. You can

Re: [Moo] Re: reduce the number of AJAX requests

2010-08-02 Thread Tim Wienk
Fabio's example might be bit easier to read, since everything happens inside the closure. In Barry's example, `clickMore` will be the return value of the closure (outer function) that is executed there. So say: var clickMore = (function(){ return function(){ alert('hai'); } })(); The outer fu

[Moo] Re: reduce the number of AJAX requests

2010-08-02 Thread Sid-ahmed D
I can not put a variable "url" in this configuration. Could you please help me ? http://jsfiddle.net/KzMDG/1/ Thank On 2 août, 11:17, Dimitar Christoff wrote: > > You should never create the request object inside the click event. > > and why not if you don't plan on recycling it? > > Best regar

[Moo] Re: reduce the number of AJAX requests

2010-08-02 Thread Sid-ahmed D
I can not put a variable "url" in this configuration. Could you please help me ? http://jsfiddle.net/KzMDG/1/ Thank On 2 août, 11:33, Sid-ahmed D wrote: > Thank you for all your reply. > > On 2 août, 11:17, Dimitar Christoff wrote: > > > > You should never create the request object inside the

[Moo] Re: BUG? moo1.2.4-core bites mootools-1.2.4.4-more

2010-08-02 Thread hamburger
thx Aaron, thats it ... i'am happy to have this professional guys here! On 28 Jul., 19:46, Aaron Newton wrote: > 1) > > el.textEl = el.getElement('.ratingText'); > > Storing properties directly on elements is a very bad practice. Use element > storage (el.store('property', value)). > > 2) when I

[Moo] Re: reduce the number of AJAX requests

2010-08-02 Thread Sid-ahmed D
Thank you for all your reply. On 2 août, 11:17, Dimitar Christoff wrote: > > You should never create the request object inside the click event. > > and why not if you don't plan on recycling it? > > Best regards, > -- > Dimitar Christoff > blog:http://fragged.org/twitter:http://twitter.com/D_mit

Re: [Moo] Re: reduce the number of AJAX requests

2010-08-02 Thread Dimitar Christoff
> You should never create the request object inside the click event. and why not if you don't plan on recycling it? Best regards, -- Dimitar Christoff blog: http://fragged.org/ twitter: http://twitter.com/D_mitar