用ajax上傳圖片,后臺說接收的數據一直是空 我這邊也不是很懂 第一次做圖片上傳 代碼如下?html<input?type="file"?class='file1'/>jqvar?formData?=?new?FormData();
?$.each($('.file1')[0].files,function(i,file){
????formData.append('file1',?file);
});
$.ajax({????
????????url:?"upload_image.do",????
????????type:?"POST",????
????????data:formData,????
????????cache:false,?????????//不設置緩存
????????????processData:?false,??//?不處理數據
??????????????contentType:?false,???//?不設置內容類型
????????????dataType:"json",????success?:?function(json){?
????????if(json.response_code?==?0?||?json.response_code?==?"0"){//成功
??????????????console.log(json.response_data)????????????????????????????????????????????
????????}else{
????????????
????????}
????}
?????????????????
});請問這么寫有沒有問題,怎么樣才能在前端看到我上傳的圖片的數據
ajax上傳圖片到后臺,接受的數據一直顯示為空
特辣黃燜雞
2018-01-09 09:25:50