首页 > 编程知识 正文

利用js提交form表单的方式,前端form表单提交到数据库

时间:2023-05-05 14:46:07 阅读:186712 作者:2358

前端使用Ajax传值方式:

body input type=' file ' id=' import file '/input type=' button ' id=' import-submit ' value='提交导入文件'/body sssyse formdata.append('file ',$ ) ' #importfile ' )0).files )0); //此处可以传递多个参数formdata.append('name ',name )。 $.Ajax(URL:(/collar/import ),type: ) post ),async: false,data: formData, processData: false //告诉jQuery不要处理发送的数据contentType: false,内容类型请求头beforeSend: function ()/进程.告诉jQuery不要设置console.log (success 3360 function (RES ) if ) RES=='1' ) ) console.log (导入成功) else

@requestmapping(/import ) (publicvoidexport ) vivoimeiupziprequest,@requestparam ) (file ) ) multipartfile,htipartipate

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。