var _csrfToken = $('meta[name=token]').attr('content');
var link = $('meta[name=url]').attr('content');
$('#upload_form').submit(function(e)
{
e.preventDefault();
var title = $('#title').val();
var designation = $('#position').val();
var category = $('#category').val();
var azimaData = {
name: title,
designation: designation,
category: category,
_token: _csrfToken
};
$.ajax({
type: 'POST',
url: link + '/@dashboard@/galleryImage/add_image',
data: azimaData,
//use contentType, processData for sure.
contentType: false,
processData: false,
success: function(msg) {
},
error: function() {
}
});
});
我正在尝试通过ajax发送表单数据。现在我只是想看看我是否可以在我的控制器中访问这些数据。
public function addGalleryImageAction(Request $request)
{
return $request->name;
}
但是当我点击提交按钮时没有任何反应..我哪里出错了?