对象不支持IE9中的属性或方法'submit'
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了对象不支持IE9中的属性或方法'submit'相关的知识,希望对你有一定的参考价值。
我正在使用jquery.fileupload.js和jquery 1.7.2。
<input class="file_upload_start" type="file" name="files[]" original-title="" multiple="multiple">
我的file.js:http://www.kcloud.vn/apps/files/js/files.js
$(function ()
$('.file_upload_start').fileupload(
dropZone:$('#content'), // restrict dropZone to content div
add:function (e, data)
var files = data.files;
var totalSize = 0;
data.submit().success(function (data, status)
response = jQuery.parseJSON(data[0].body.innerText);
if (response[0] != undefined && response[0].status == 'success')
var file = response[0];
delete uploadingFiles[file.name];
$('tr').filterAttr('data-file', file.name).data('mime', file.mime);
var size = $('tr').filterAttr('data-file', file.name).find('td.filesize').text();
if (size == t('files', 'Pending'))
$('tr').filterAttr('data-file', file.name).find('td.filesize').text(file.size);
FileList.loadingDone(file.name);
当我运行它时,出现错误:
SCRIPT438:对象不支持属性或方法“提交”files.js,第387行,字符37
如何解决?
答案
下面是从http://www.kcloud.vn/apps/files/js/files.js到387行的摘录。代码注释包含解释。
$(function ()
$('.file_upload_start').fileupload(
dropZone: $('#content'), // restrict dropZone to content div
add: function (e, data)
//data.submit() should definitely exist in this scope.
//...stuff...
$.ajax(
url: '/?app=files&getfile=ajax%2Fupload.php',
dataType: "json",
success: function (data)
//which "data" is scoped here? "add" (parent) or "success" (local)?
//IE is picking local scope, not parent, which is causing your error.
//Rename the parameter variable to something else.
if (data.data.message == "DAT")
//...stuff...
else
if (files)
//...stuff...
if (totalSize > $('#max_upload').val())
//...stuff...
else
if ($.support.xhrFileUpload)
//...stuff...
else //"data" below in "success" scope does not have a "submit" method, hence your error.
data.submit().success(function (data, status) // <-- Line 387
//Yet another parameter variable named "data".
//This is asking for more trouble, rename this one too,
//or define your functions elsewhere and reference them here.
//...stuff...
);
//...stuff...
以上是关于对象不支持IE9中的属性或方法'submit'的主要内容,如果未能解决你的问题,请参考以下文章
Object不支持此属性或方法 - 在IE9中调用Applet
jquery 3.1.1错误:对象不支持属性或方法'andSelf'