I am trying to get a jQuery.ajax to call back to the calling instance to process messages. However, I cannot get the calling instance into the function.
In the GetHistory call, a list of messages are returned and I want the Process method to act on each one. The problem is that during the callback function execution an error is returned stating "this.Process is undefined". This is why I am guessing the instance is not being set.
I also tried adding the parameter to .ajax of 'context:this', but that didn't seem to help.
class MessageHandler
@messages: []
Process: (message) ->
messages.push message
GetHistory: ->
jQuery.ajax url:'/home/BidDetail', dataType: 'json', data: 'auctionId=1', success: (data) ->
@Process record for record in data.records when record.type == 'BID'