$(document).on('click', '.create-json', function(e) {
    e.preventDefault();
	var id=$(this).data('id');
    $.ajaxSetup({

		headers: {
			  'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
			} 
		  });
			
		  $.ajax({ 
			url:url_createJson,
			method:"GET",		   
			data:{
			  id:id,
			  },
		
    success: function (data) {
		var filename = data[0].DocDtls.NO;

		 if (!(data instanceof Blob)) {
            data = new Blob([JSON.stringify(data, null, 2)], {
			type: 'application/json'
			});
        }
        
        const url = URL.createObjectURL(data);

        const a = document.createElement('a');
        a.href = url;
        a.download = filename+'_datafile.json';
        a.click();
    }
});
});
