[Javascript] Prevent Prototype Ajax from firing twice

Michael Borchers list at tridemail.de
Wed Feb 27 07:41:02 CST 2008


> If you're only seeking to prevent duplicate requests while the first
> request is pending, you can set urlRequested[ url ] = false in your
> response handler.  Otherwise the requests will only go once ever.
> This gets more complicated if your requests are distinguished by more
> than just URL, but the same general technique should work.
>
> Peace,
> Scott

I think I found the major problem in my script. Everytime a link is clicked 
a function is called
to use f.e. the scriptaculous autocompleter.

Every time the function is called a new class is constructed:

function foo() {
 compl = new Ajax.Autocompleter...
}

Since the, when the request ist fired, yet another follows, and another one, 
and ...!
So it multiplies itself.

I need to find a way to "desctruct" the autocompleter! Any ideas? 




More information about the Javascript mailing list