【发布时间】:2020-06-24 10:02:20
【问题描述】:
前台通过Ajax向后台发送ID,但后台从不接收。我被这个问题困扰了一整天,真的需要你的帮助。这是我的JS和Controller以及错误信息
$('.category-wrap').on('click', '.now .delete', function (e) {
var target = e.currentTarget;
var pc = target.dataset.id;
var pcId = {'pcId':pc};
$.confirm('sure?',function () {
$.ajax({
url: deleteUrl,
type: 'POST',
data: pcId,
contentType: 'application/json',
cache: false,
success: function (data) {
if (data.success) {
$.toast('successfully delete!');
getList();
} else {
$.toast('Delete failed!');
}
}
});
})
});
@RequestMapping(value = "/removeproductcategory", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> removeProductCategory(@RequestBody Integer pcId,
HttpServletRequest request)
{...}
【问题讨论】: