我试图ajax
提交表单。这是代码:
var data = new FormData();
data.append("test","testvar");
var opt = {
url:"{{route(email-process.store)}}",
type:'POST',
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
data:data,
async:true,
processData: false,
success:function(result){
console.log(result);
}
};
if(data.fake) {
// Make sure no text encoding stuff is done by xhr
opt.xhr = function() { var xhr = jQuery.ajaxSettings.xhr(); xhr.send = xhr.sendAsBinary; return xhr; }
opt.contentType = "multipart/form-data; boundary="+data.boundary;
opt.data = data.toString();
}
$.ajax(opt);
控制器部分:
public function store(Request $request)
{
dd($request->all());
}
网络标签 returns []