awj*_*awj 5 forms ajax jquery asynchronous file-upload
我正在使用jquery.form插件在MVC项目中异步上传文档.
从我之前的回答中取得领导,这是我在页面上的内容:
<% using(Html.BeginForm("Create", "JobFile", FormMethod.Post, new { id = "uploadForm", enctype = "multipart/form-data" })) %>
<% { %>
<%: Html.ValidationSummary() %>
<input type="file" id="fileToUpload" />
<input type="submit" value="Upload file" />
<input type="text" id="RelatedFileName" />
<% } %>
<script type="text/javascript" src="../../Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="../../Scripts/jquery.form.js"></script>
<script type="text/javascript">
$(function () {
$('#uploadForm').ajaxForm(function (result) {
if (result.errorMessage != '') {
alert(result.errorMessage);
} else {
$('#RelatedFileName').val(result.fileName);
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
我的问题是,当页面加载时,我得到以下javascript错误:
未捕获的TypeError:对象#没有方法'ajaxForm'
在包含的行上找到此错误
$('#uploadForm').ajaxForm(function (result) {
Run Code Online (Sandbox Code Playgroud)
谁能告诉我为什么我会收到这个错误?