如何将得到的数据作为参数传入按钮触发的函数中?

根据表单填写的数据生成json格式的数据;
现要将这些数据作为函数的参数;
如何实现?

var data1 = {};
            $(function (){
                $("#fun").click(function (){
                    var data = {};
                    $("form").serializeArray().map(function(x){
                        if (data[x.name] !== undefined) {
                            if (!data[x.name].push) {
                                data[x.name] = [data[x.name]];
                            }
                            data[x.name].push(x.value || '');
                        } else {
                            data[x.name] = x.value || '';
                        }
                    });
                    data1 = $("#result").html(JSON.stringify(data));
                });
            });
            function download(text, name, type) {
                var a = document.getElementById("a");
                 var file = new Blob([text], {type: type});
                 a.href = URL.createObjectURL(file);
                    a.download = name;
                    a.dispatchEvent(new MouseEvent('click', {'bubbles': false, 'cancelable': true}));
            }   

这是按钮:

<input type="button" onclick="download(data1, 'SWCL_MANIFEST.txt', 'zhaodongxu/Workspace/Module')" value="creat file">