我使用這個版本的jQuery表格插件https://raw.github.com/malsup/form/master/jquery.form.js 的獲得上提交的錯誤:jQuery的形式上傳錯誤
錯誤就行form.submit();
SCRIPT87: Invalid argument. jquery.form.js, line 347 character 5
我的代碼:
<form id="ajaxUploadForm" action="@Url.Action("Upload", "Home")%>" method="post" enctype="multipart/form-data" >
<fieldset>
<legend>Upload a file</legend>
<label>File to Upload: <input type="file" name="file" /></label>
<input id="ajaxUploadButton" type="submit" value="Upload" />
</fieldset>
</form>
$(function() {
$("#ajaxUploadForm").ajaxForm({
iframe: true,
dataType: "json",
beforeSubmit: function() {
// $("#ajaxUploadForm").block({ message: '<img src="/Content/themes/start/images/progress.gif" />' });
},
success: function (result) {
// $("#ajaxUploadForm").unblock();
//$("#ajaxUploadForm").resetForm();
$.growlUI(null, result.message);
},
error: function (xhr, textStatus, errorThrown) {
//$("#ajaxUploadForm").unblock();
//$("#ajaxUploadForm").resetForm();
$.growlUI(null, 'Error uploading file');
}
});
});
我我在側面的簡單模型對話框中做這個上傳。
可能有人會有任何想法如何解決這個問題?
問題是提交不出現,我把斷點,並在調試下檢查它,它不提交,還查看了提琴手以確保請求不會去別的地方,根本沒有請求,由於某種原因,它只是提交失敗。嗯...順便說一句,我已經包裹在我的控制器響應 – Joper
@Joper,嗯,這很奇怪。你有沒有試過以正常形式做這件事(jQuery對話框中沒有一個)? –
在Mozilla嘗試了另一個瀏覽器(Mozilla的最新版本),它發送請求(可以在Fidder中看到它,但是在調試時我沒有看到控制器上發出的請求),但得到錯誤「ReadResponse()失敗:服務器沒有返回這個請求的響應'。之前試圖Opera最新和IE最新 – Joper