function activate_user(user_id, active){
    //var button_id       = this.id;
    //var button_id_array = button_id.split('-');
    //var user_id         = button_id_array[1];
    //var active          = button_id_array[2];

    if(active == '1'){
        $('#user_activation').html('activate');
    }else{
        $('#user_activation').html('de-activate');
    }

    $( "#dialog-confirm" ).removeClass('hide').dialog({
        resizable: false,
        modal: true,
        title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-exclamation-triangle red'></i> User Activation!</h4></div>",
        title_html: true,
        buttons: [
            {
                html: "<i class='ace-icon fa fa-trash-o bigger-110'></i>&nbsp; Proceed",
                "class" : "btn btn-danger btn-xs",
                click: function() {
                    $( this ).dialog( "close" );
                    $body = $("body");
                    $body.addClass("loading");
                    window.location.href = base_url + 'index.php/survey/activate_user/' + user_id + '/' + active;
                }
            }
            ,
            {
                html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; Cancel",
                "class" : "btn btn-xs",
                click: function() {
                    $( this ).dialog( "close" );
                }
            }
        ]
    });
}
$(function(){
    $(document).ready(function() {
        $('#all_users').dataTable({
            "bDeferRender": true,
            "sAjaxSource": base_url+'index.php/survey/get_all_users_ajax'
        });

        $('#tbl_active_request').dataTable();
        $('#tbl_approved_request').dataTable();

    } );

    $('button[approve]').button().click(function(){
        var btn_data        = this.id;
        var btn_data_array  = btn_data.split('-');
        var request_id      = btn_data_array[1];

        var user_name = '#user_name-' + request_id;
        var org_name = '#org_name-' + request_id;
        var pro_name = '#pro_name-' + request_id;

        $('#dialog_user_name').html($(user_name).val());
        $('#dialog_org_name').html($(org_name).val());
        $('#dialog_pro_name').html($(pro_name).val());

        $( "#dialog-confirm-request_approval" ).removeClass('hide').dialog({
            resizable: false,
            modal: true,
            width:400,
            title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-exclamation-triangle red'></i> Approve new programme participation!</h4></div>",
            title_html: true,
            buttons: [
                {
                    html: "<i class='ace-icon fa fa-trash-o bigger-110'></i>&nbsp; Proceed",
                    "class" : "btn btn-danger btn-xs",
                    click: function() {
                        $( this ).dialog( "close" );
                        $body = $("body");
                        $body.addClass("loading");
                        window.location.href = base_url + 'index.php/survey/approve_new_programme/' + request_id;
                    }
                }
                ,
                {
                    html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; Cancel",
                    "class" : "btn btn-xs",
                    click: function() {
                        $( this ).dialog( "close" );
                    }
                }
            ]
        });

    });

    $( "input[allow_attempt]" ).spinner({
        create: function( event, ui ) {
            //add custom classes and icons
            $(this)
                .next().addClass('btn btn-success').html('<i class="ace-icon fa fa-plus"></i>')
                .next().addClass('btn btn-danger').html('<i class="ace-icon fa fa-minus"></i>')

            //larger buttons on touch devices
            if('touchstart' in document.documentElement)
                $(this).closest('.ui-spinner').addClass('ui-spinner-touch');
        },
        min: 0,
        change: function( event, ui ) {
            $.ajax({
                type:   'post',
                url:    base_url + 'index.php/survey/update_attempt_allowed',
                data:   {user_data:this.id,value:this.value},
                success: function(data, status){
                    //alert(data);
                }
            });
        }
    });

    $('button[activate]').button().click(function(){
        var button_id       = this.id;
        var button_id_array = button_id.split('-');
        var user_id         = button_id_array[1];
        var active          = button_id_array[2];

        if(active == '1'){
            $('#user_activation').html('activate');
        }else{
            $('#user_activation').html('de-activate');
        }

        $( "#dialog-confirm" ).removeClass('hide').dialog({
            resizable: false,
            modal: true,
            title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-exclamation-triangle red'></i> User Activation!</h4></div>",
            title_html: true,
            buttons: [
                {
                    html: "<i class='ace-icon fa fa-trash-o bigger-110'></i>&nbsp; Proceed",
                    "class" : "btn btn-danger btn-xs",
                    click: function() {
                        $( this ).dialog( "close" );
                        $body = $("body");
                        $body.addClass("loading");
                        window.location.href = base_url + 'index.php/survey/activate_user/' + user_id + '/' + active;
                    }
                }
                ,
                {
                    html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; Cancel",
                    "class" : "btn btn-xs",
                    click: function() {
                        $( this ).dialog( "close" );
                    }
                }
            ]
        });

    });
});
@@ -38,192 +38,8 @@
 e)%7B%0A
-    //var button_id       = this.id;%0A    //var button_id_array = button_id.split('-');%0A    //var user_id         = button_id_array%5B1%5D;%0A    //var active          = button_id_array%5B2%5D;%0A%0A
     
@@ -4203,1582 +4203,7 @@
 );%0A%0A
-    $('button%5Bactivate%5D').button().click(function()%7B%0A        var button_id       = this.id;%0A        var button_id_array = button_id.split('-');%0A        var user_id         = button_id_array%5B1%5D;%0A        var active          = button_id_array%5B2%5D;%0A%0A        if(active == '1')%7B%0A            $('#user_activation').html('activate');%0A        %7Delse%7B%0A            $('#user_activation').html('de-activate');%0A        %7D%0A%0A        $( %22#dialog-confirm%22 ).removeClass('hide').dialog(%7B%0A            resizable: false,%0A            modal: true,%0A            title: %22%3Cdiv class='widget-header'%3E%3Ch4 class='smaller'%3E%3Ci class='ace-icon fa fa-exclamation-triangle red'%3E%3C/i%3E User Activation!%3C/h4%3E%3C/div%3E%22,%0A            title_html: true,%0A            buttons: %5B%0A                %7B%0A                    html: %22%3Ci class='ace-icon fa fa-trash-o bigger-110'%3E%3C/i%3E&nbsp; Proceed%22,%0A                    %22class%22 : %22btn btn-danger btn-xs%22,%0A                    click: function() %7B%0A                        $( this ).dialog( %22close%22 );%0A                        $body = $(%22body%22);%0A                        $body.addClass(%22loading%22);%0A                        window.location.href = base_url + 'index.php/survey/activate_user/' + user_id + '/' + active;%0A                    %7D%0A                %7D%0A                ,%0A                %7B%0A                    html: %22%3Ci class='ace-icon fa fa-times bigger-110'%3E%3C/i%3E&nbsp; Cancel%22,%0A                    %22class%22 : %22btn btn-xs%22,%0A                    click: function() %7B%0A                        $( this ).dialog( %22close%22 );%0A                    %7D%0A                %7D%0A            %5D%0A        %7D);%0A%0A    %7D);%0A
 %7D);

delete un-necessary code