没有文件的AjaxForm提交给出500错误

时间:2015-04-24 02:56:52

标签: jquery file upload ajaxform

如果我在提交时附加文件,我有jQuery AjaxForm工作,但没有附加文件,它无法提交,它给出500错误。我在apache tomcat上使用Spring作为后端  

{jQuery('#newSchoolForm').ajaxForm({
type: "POST",
async:false, url: 'newSchool.do?action=save', mimeType:"multipart/form-data", processData: false, contentType:false, success: function(data) {

              $('#errorMsg').append("<li>"+data+"</li>");

            },  
          error: function(e)
            {   $('#errorMsg').append(e.responseText);
                $('#errorMsg').append("<li>Unexpected Error .Please Try again later.</li>");
            }  
                 }).submit();

    }
        });}

$('#errorMsg').append("<li>"+data+"</li>"); }, error: function(e) { $('#errorMsg').append(e.responseText); $('#errorMsg').append("<li>Unexpected Error .Please Try again later.</li>"); } }).submit(); } });}

And my form is like below , I am calling above ajax on button click:

0 个答案:

没有答案