You have to bind your setInterval callback just like you bind your
onSuccess callback...
initialize: function() {
setInterval(this.checkForMessages.bind(this), 20000);
},
On Oct 20, 1:10 am, Travis <[EMAIL PROTECTED]> wrote:
> I am trying to implement the following:
>
> var Messaging = Class.create({
> initialize: function() {
> setInterval(this.checkForMessages, 20000);
> },
> checkForMessages: function(event) {
> var options = {
> method: 'get',
> onSuccess: this.pushData.bind(this)
> }
>
> new Ajax.Request('/messages/check', options);
> },
> pushData: function(transport) {
> alert(transport.responseText);
> }
>
> });
>
> Unfortunately, I get an error "this.pushData is null or not an
> object". I think it's a binding issue but I'm not sure since I though
> I had binded "this" to pushData. Any help would be great, thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---