Hi jQuery experts,

I am encountering a problem with looping through calendar evvents.  I
am using the dhtmlx scheduler product for the calendar functionality.
This javascript product loads a page containing the calendar and after
requesting from the server, it is filled with calendar events.

Each calendar event is described using a <div> tag with an "event_id"
custom attribute.  I wrote a piece of jquery that displays a dialog
whenever the user clicks on any event on the calendar.  I used live()
event handler because the calendar page is rendered empty initially.
Only after the page has loaded, calendar events will be requested from
the server (this behaviour is beyond my control, it is what the
product does to display calendar events).

The problem I am facing is that the user is only able to click at most
2 events before my Firebug debugging console shows an error saying:
"too much recursion".  What I gather from this is that jQuery is
unalbe to maintain a stack big enough for me to load in all the
calendar events in my page.  Here's my code that I used:

jQuery("div[event_id]").live("click", function() {
        var class_info = jQuery(this).text();
        var class_name = class_info.substring(6);
        var eid = jQuery(this).attr("event_id");
        jQuery('#dialog').dialog({
                bgiframe: true,
                modal: false,
                title: class_name,
                hide: {effect: "fadeOut", duration: 500},
                width: 600,
                height: 400,
                autoOpen: false,
                buttons: {
                        'Request Enrollment': function() {
                            jQuery.ajax({
                                url: '/classes/enroll_using_session/'+eid,
                                type: 'POST',
                                success: function(data) {
                                        
jQuery('#dialog').prepend(data).hide().fadeIn('slow');
                                }
                            });
                            jQuery(this).attr("disabled", "disabled");
                        },
                        'Cancel': function() {
                                jQuery(this).dialog('close');
                        }
                }
        });
        jQuery.ajax({
                url: '/classes/load_calendar_dialog/'+eid,
                        dataType: 'html',
                        type: 'POST',
                        success: function(data) {
                                jQuery('#dialog').html(data);
                                jQuery('#dialog').dialog('open');
                        }
        });
});

Could someone please tell me a way to solve this?  Am I supposed to
unbind/die/kill an active event handler before continuing on to the
next?
-- 
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to