maybe it doesn't understands so well; the issue is access de
ajax.request instance who fired the handler function, how this can be
done?...
On 21 nov, 20:37, Rodrigo Carvajal <[EMAIL PROTECTED]>
wrote:
> i'm sending multiple ajax.request instances when i search for
> something when the 'keypress' event is fired; this is not a problem
> unless sometimes some ajax.request's don't came back in the same order
> that they was sended... in some cases earlier requests came back after
> late requests and that can be anoying to the user... i was thinking in
> atach to the request a timestamp and in the handler function wait for
> the last timestamp in the last request and dismiss the others; i don't
> know if there exists a more elegant way to do this...i was thinking to
> send the timestamp in the request and send it back from the server and
> check it that way but i would like to do in the client side only...
>
> example:
>
> $('textbox').observe('keypress', this.send_request.bind(this));
>
> ...
>
> this.send_request = function() {
>
> options.onComplete = this.ajax_handler; // Handler function for the
> request...
>
> var current_date = new Date();
>
> timestamp = current_date.getTime();
>
> options.timestamp=timestamp; // Timestamp in the Ajax options for
> identify it in the handler...
> this.expected_timestamp=timestamp;
>
> this.ajax_object = new Ajax.Request('sql.php', options); // Generate
> Request...
>
> }
>
> this.ajax_handler = function(response) {
>
> // Do anything i have to do here...
> // There i need to know the timestamp asociated by the ajax object
> that triggered this
> // function in order to use it only if is the last request and dismiss
> others
> // ....
>
> }
>
> thanks in advance for the help... ( and excuse my poor english ...)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---