Ajax未捕获的TypeError:非法调用

时间:2018-06-23 06:29:04

标签: javascript ajax

enter image description here 我看过所有教程,但并没有改变

$(document).ready(function(e){
 $('#formImage').on('submit', function(e){  
    e.preventDefault();     
    $.ajax({
      url: '../php/insertImage.php',
      type: 'post',
      data: new FormData(this),
      prosessData:false,
      contentType: false,
      success:function(e){
        console.log(e);
        alert(e);
      }
    });
  });
});

这是我的表格

<form action="" method="post" enctype="multipart/form-data" class="form-horizontal" id="formImage">
          <div class="form-group col-md-12 row" style="margin-top: 50px;">

            <label class="col-form-label">Input picture here</label>
            <div class="col-md-6">
              <input type="file" name="inputfile" id="my-pic" class="form-control">
            </div>
              <div>
                <button type="submit" class="btn btn-primary" id="upload-mypic">Upload</button>
              </div>
          </div>
        </form>

我不知道了..请帮助 谢谢

2 个答案:

答案 0 :(得分:1)

您是否注意到processData的拼写?您已经写了prosessData。

答案 1 :(得分:0)

请检查您的拼写错误。

prosessData:false,

$(document).ready(function(e){
 $('#formImage').on('submit', function(e){  
    e.preventDefault();     
    $.ajax({
      url: '../php/insertImage.php',
      type: 'post',
      data: new FormData(this),
      processData:false,
      contentType: false,
      success:function(e){
        console.log(e);
        alert(e);
      }
    });
  });
});