views:

40

answers:

0

Hello all, I'm working with jQuery UI and the dialog plugin. I have a Manager Response form that appears in the dialog box that appears when a user clicks on a certain link. What happens is I acquire the ID for that response, do some processing and send back the view that I insert in to a for the dialog box. It works fine the first time, but the second load of the dialog box removes all of my CSS and JS. Any way to prevent this from happening? Here is the code sample in question:

$(function(){

$('a#manager-response').click(function(){
    var surveySessionID = $(this).children().attr('id'); 

    //Get the Survey Session
    $.ajax({
        type: 'POST', 
        url: '<?= site_url('AJAX/manager_response_ajax/response'); ?>/'+surveySessionID, 
        success: function(i){
            $('#modal').remove().html(i); 
            $('#modal').dialog({
                width: 675, 
                height: 700, 
                cache: false,
                modal: true,
                close: function(ev, ui){
                    $('#modal').dialog('destroy'); 
                }
            }).dialog('open'); 
        }
    });


    return false; 
}); 

});