



$('#program_code_salary').on('change',function(e){
    e.preventDefault();
    
   var program_code=$(this).val();
   var siteUrl=$('#designation_by_program').val(); 
    
   
   if((program_code) && (siteUrl)){
       var calldesignation = $.ajax({
                url: siteUrl,
                method: "GET",
                data: {
                    program_code: program_code
                },
                dataType: "json"
            });

            calldesignation.done(function (data) {
              if(data.msgType==true){
                  $('#designation_code').empty();
                  $('#designation_code').append('<option value=""> Select a designation </option>');
                  $.each( data.data, function( key, value ) {
                       $('#designation_code').append('<option value="'+value.designation_code+'">'+ value.designation_name +'</option>');
                  });                
              }else{
                  toastr.error(data.msg); 
              }
            });
   }else{
       $('#designation_code').empty();
       $('#designation_code').append('<option value=""> Select a designation </option>');
       toastr.error('Please select a program.');
   }
    
    
    
});



$('#module_privilege').on('change',function(e){
    e.preventDefault();
    
   var module_code=$(this).val();
   var siteUrl=$('#functionality_by_module').val(); 
    
   if((module_code) && (siteUrl)){
       var calldesignation = $.ajax({
                url: siteUrl,
                method: "GET",
                data: {
                    module_code: module_code
                },
                dataType: "json"
            });

            calldesignation.done(function (data) {
              if(data.msgType==true){
                  $('#function_privilege').empty();
                  $('#function_privilege').append('<option value=""> Select a Function </option>');
                  $.each( data.data, function( key, value ) {
                       $('#function_privilege').append('<option value="'+value.function_code+'">'+ value.function_name+'</option>');
                  });                
              }else{
                  toastr.error(data.msg); 
              }
            });
   }else{
       toastr.error('Please select a Module.');
   }
    
    
    
});