使用jQuery AJAX和Handler(ashx)上传文件无效

使用jQuery AJAX和Handler(ashx)上传文件无效,第1张

使用jQuery AJAX和Handler(ashx)上传文件无效

设法使这个工作:)

这是我的代码

///create a new FormData objectvar formData = new FormData(); //var formData = new FormData($('form')[0]);///get the file and append it to the FormData objectformData.append('file', $('#file')[0].files[0]);///AJAX request$.ajax({    ///server script to process data    url: "fileupload.ashx", //web service    type: 'POST',    complete: function ()    {        //on complete event         },    progress: function (evt)    {        //progress event        },    ///Ajax events    beforeSend: function (e) {        //before event      },    success: function (e) {        //success event    },    error: function (e) {        //errorHandler    },    ///Form data    data: formData,    ///Options to tell JQuery not to process data or worry about content-type    cache: false,    contentType: false,    processdata: false});///end AJAX request


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4953060.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-13
下一篇2022-11-13

发表评论

登录后才能评论

评论列表(0条)

    保存