I have a situation that I am not sure how to approach. I have a global variable @date which gets loaded in an ajax action:
def calendar_ajax @date = Time.parse("#{params[:date]} || Time.now.utc")
This @date is used to find events for the calendar. A partial is then rendered:
render :update do |page| page.replace_html "internal_calendar_box", :partial => 'calendar_large_data' end
I then have javascript functions which are within tabs and triggered by an onclick that then create an ajax request in order to populate the calendar with a different kind of request. The problem I am facing is that the javascript function needs to send the current @date variable, which changes upon the change of a month, but the original @date object is always being passed. I think the problem lies in the fact that this javascript function does not see the new @date objects that are being created when the month is changed and a new partial is created. I tried sticking these functions within the partial itself, but that does not seem to work. Anyone have any ideas?