在使用js的时候,需要写一个方法,需要传输多个参数,试了两种方法,记录一下。
function uploadFile(student_info_id ,name) {
    swal({
      title: "Ajax请求示例"+student_info_id+name,
      text: "提交运行ajax请求",
      type: "input",
      inputType: "file",
      showCancelButton: true,
      closeOnConfirm: false,
      showLoaderOnConfirm: true,
      confirmButtonText: "上传",
      cancelButtonText: "取消"
    },
    function(){
      setTimeout(function(){
        swal("Ajax请求完成!");
      }, 2000);
    });
}js函数出书多个参数的方法:
1、直接写:
注意:字符串需要加引号,不然不能识别!
<a onclick="uploadFile({{$element->id}},'{{$element->chinese_name?:$element->english_name}}')">上传报告</a>2、方法二:
json格式上传,作为一个参数。
<a onclick="uploadFile({student_info_id:'{{$element->id}}', name:'{{$element->chinese_name?:$element->english_name}}'})">上传报告</a>取用:
title: "Ajax请求示例"+param.student_info_id+param.name,效果图

                
                










