我的Ajax发布有问题。阿贾克斯:
var formData = new FormData();
formData.append('file', files);
formData.append("url", url);
$.ajax({
url : "/servisDetail/uploadSoubor",
type : 'GET',
processData: false,
contentType: false,
data : formData,
success : function(response) {
console.log(response);
//vypisPrilohy(response);
},
error: function (xhr) { }
});
和java:
@RequestMapping(value = "/servisDetail/uploadSoubor", method= RequestMethod.GET)
public @ResponseBody
ModelMap servisDetailUploadFile(@RequestParam(value = "file",required = false) MultipartFile soubor,
@RequestParam(value = "url",required = false) String odkaz,
Locale locale){
ModelAndView model = new ModelAndView();
System.err.println("File: " + soubor + " and " + odkaz);
return model.getModelMap();
}
但是打印到控制台的是:File:null和null。
没有processData:false我有一个ajax错误:非法调用和类型get或post仍然相同
有谁知道如何修理它?
相关分类