$.ajax({
url: "${pageContext.request.contextPath}/something/somthing",
data: oMyForm,
type: "POST",
processData: false,
contentType: false,
beforeSend: function () {
alert("beforeSend");
status.empty();
var percentVal = '0%';
bar.width(percentVal);
percent.html(percentVal);
},
uploadProgress: function (event, position, total, percentComplete) {
alert("uploadProgress");
var percentVal = percentComplete + '%';
bar.width(percentVal);
percent.html(percentVal);
},
success: function () {
alert("success");
var percentVal = '100%';
bar.width(percentVal);
percent.html(percentVal);
},
complete: function (xhr) {
alert("xhr:" +xhr);
alert("complete");
status.html(xhr.responseText);
}
});
在这里,我可以从控制器获取一个文件,并在uploadprogress中设置警报,但它不会到来。你能解决这个问题吗?
提前谢谢