jQuery ajaxForm和 ajaxSubmit注意

http://jquery.malsup.com/form/#file-upload

在使用jQuery异步上传时,需要注意在存在文件上传时,要将返回数据的contentType设置为text/html,同时返回值应该为字符串

否则,该插件将不能执行参数success中指定回调函数。

原文如下:

To account for the challenges of script and JSON responses when using the iframe mode, the Form Plugin allows these responses to be embedded in a textarea element and it is recommended that you do so for these response types when used in conjuction with file uploads and older browsers.

It is important to note that even when the dataType option is set to 'script', and the server is actually responding with some javascript to a multipart form submission, the response's Content-Type header should be forced to text/html, otherwise Internet Explorer will prompt the user to download a "file".

上一篇:循环列表,获取勾选的checkbox中某个的值


下一篇:Verilog代码规范I