本文主要是介绍form.ajaxSubmit获取上传的文件名,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
var form = $("form[name=fileForm]");$("#uploadTip").html("正在上传...");var options = {action: '/optimizationJob/uploadFile.action',type: 'post',data: {fileName:fileName },//传递文件名到服务器success: function (data) {var success = data.success;var errMsg = data.errMsg;if (success == "Y") {console.log("上传成功,返回success=Y,errMsg:" + errMsg);$("#uploadTip").html("上传成功");// uploadFileToJSS(fileName);} else {console.log("上传失败,返回success=N,errMsg:" + errMsg);$("#uploadTip").html("上传失败");}$("#submitBtn").attr("disabled", false);},error: function (data) {console.log("上传失败,返回error");$("#uploadTip").html("上传失败");$("#submitBtn").attr("disabled", false);}};form.ajaxSubmit(options);
java中的Action写好fileName的set,get方法,就能使用了
这篇关于form.ajaxSubmit获取上传的文件名的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!