Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 读取后,我的Ajax无法读取文件_Javascript_Jquery_Html_Ajax - Fatal编程技术网

Javascript 读取后,我的Ajax无法读取文件

Javascript 读取后,我的Ajax无法读取文件,javascript,jquery,html,ajax,Javascript,Jquery,Html,Ajax,im使用API传递整个表单,包括图像、文本区域等 它使用newformdata($('#form'))将数据传递到服务器 除了我在 每次用户上传新照片时,我都会输入显示图像 $(function() { $("#upload").on("change", function() { var files = !!this.files ? this.files : []; if (!files.length || !window.FileReader) return; // no fi

im使用API传递整个表单,包括图像、文本区域等

它使用
newformdata($('#form'))
将数据传递到服务器

除了我在

每次用户上传新照片时,我都会输入显示图像

$(function() {
$("#upload").on("change", function()
{
    var files = !!this.files ? this.files : [];
    if (!files.length || !window.FileReader) return; // no file selected, or no FileReader support

    if (/^image/.test( files[0].type)){ // only image file
        var reader = new FileReader(); // instance of the FileReader
        reader.readAsDataURL(files[0]); // read the local file

        reader.onloadend = function(){ // set image data as background of div
             //Showing the images here..
        }
    }
});
});
但是现在,当我再次使用Ajax提交表单时,它无法读取或传递图像。数据库中未传递任何图像

每当我注释行
//var files=!!这是什么文件?此文件为:[]恢复正常,但图像未显示

我想问一下,是否有其他方法可以在不影响