 function store(){
       event.preventDefault();
       $('form *').removeClass('is-invalid');
       var action = $('#form').attr('action');
       
       var urls = action;
       var form = $('#form')[0];

var data = new FormData(form);
       $.ajax({
          url : urls,
          enctype: 'multipart/form-data',
          type : 'POST',
          data : data,
          processData: false,  
          contentType: false,
          
          success:function(data)
          {
              $('.ajaxErrorResponse').css("display", "none");
              $('.ajaxResponse').css("display", "block");
            $('.ajaxResponse').html(data.message);
          }
          ,error: function (data) {
              $('.ajaxResponse').css("display", "none");
    $('.ajaxErrorResponse').css("display", "block");
   $('.ajaxErrorResponse').html('');
   $.each(data.responseJSON.errors, function(key,value) {
     $('.ajaxErrorResponse').append('<div class="alert alert-danger">'+value+'</div');
     
     var keys = key.replaceAll(".","_");
     
     $('#'+keys).attr('class','form-control is-invalid');
 }); 
 
}
        })
   }
   
   
    function update(){
       event.preventDefault();
       $('form *').removeClass('is-invalid');
       var action = $('#form').attr('action');
       
       var urls = action;
       var form = $('#form')[0];
       

var data = new FormData(form);
       $.ajax({
          url : urls,
          enctype: 'multipart/form-data',
          type : 'POST',
          data : data,
          processData: false,  
          contentType: false,
          
          success:function(data)
          {
              $('.ajaxErrorResponse').css("display", "none");
              $('.ajaxResponse').css("display", "block");
            $('.ajaxResponse').html(data.message);
          }
          ,error: function (data) {
              $('.ajaxResponse').css("display", "none");
    $('.ajaxErrorResponse').css("display", "block");
   $('.ajaxErrorResponse').html('');
   $.each(data.responseJSON.errors, function(key,value) {
     $('.ajaxErrorResponse').append('<div class="alert alert-danger">'+value+'</div');
     
     var keys = key.replaceAll(".","_");
     
     $('#'+keys).attr('class','form-control is-invalid');
 }); 
 
}
        })
   }
   

  function addform(elem) {
  
      var form = $(elem).attr('data-id');
      

      var numform = parseInt(form)+1; 
      
      $(elem).attr('data-id', numform);
      
        $.ajax({
          url : url_addform+'/'+form,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#body').append(data);
          }
        })
}
function editform(elem) {
  
      var form = $(elem).attr('data-id');
      
      
      var numform = parseInt(form)+1; 
      
      $(elem).attr('data-id', numform);
      
        $.ajax({
          url : url_editform+'/'+form,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#body').append(data);
          }
        })
}
    function removeform(elem){
 $(elem).closest('tr').remove();
    }
     function deleteform(elem){
      var form = $(elem).attr('row-id');
      
      $(elem).closest('tr').remove();
      
        $.ajax({
          url : url_deleteform+'/'+form,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            
          }
        })
     }