我通过AjaxUpload选项上传文件。我需要将一些动态参数值传递给action。我的代码如下:
$("#btnImportUtility_Upload").ajaxSubmit(function () {
new AjaxUpload('#btnImportUtility_Upload', {
action: 'FileUploader.ashx?path=ExcelImportUtility&companyId=' + $("#ddlCompany option:selected").val() + '',
name: 'upload',
onSubmit: function (file, ext) {
if (!(ext && /^(txt|csv|xls|xml|xlsx)$/i.test(ext))) {
alert('Invalid File Format.');
return false;
}
},
onComplete: function (file, response) {
}
});
});
我想获取当前选定的下拉值,但它始终获得其初始值。
答案 0 :(得分:0)
尝试这个
$("#btnImportUtility_Upload").ajaxSubmit(function () {
new AjaxUpload('#btnImportUtility_Upload', {
action: 'FileUploader.ashx?path=ExcelImportUtility&companyId=' + $("#ddlCompany").val() + '',
name: 'upload',
onSubmit: function (file, ext) {
if (!(ext && /^(txt|csv|xls|xml|xlsx)$/i.test(ext))) {
alert('Invalid File Format.');
return false;
}
},
onComplete: function (file, response) {
}
});
答案 1 :(得分:0)
试试这个,
$("#btnImportUtility_Upload").ajaxSubmit(function () {
new AjaxUpload('#btnImportUtility_Upload', {
action: 'FileUploader.ashx?path=ExcelImportUtility&companyId=' + $('#ddlCompany').val() + '',
name: 'upload',
onSubmit: function (file, ext) {
if (!(ext && /^(txt|csv|xls|xml|xlsx)$/i.test(ext))) {
alert('Invalid File Format.');
return false;
}
},
onComplete: function (file, response) {
}
你的下拉菜单<选择>对 ?请发帖也是