Hello everyone, tell me what functions there are to find out the error when saving data. I get the data myself using the Jquery method serialize () and then send it via Ajax to the controller but they do not want to be saved to the database

$('#add_new_player').click(function(event) { event.preventDefault() $.ajax({ url:"/Group/Players/add_player", success:function(data) { pl_dialog.html(data) pl_dialog.dialog("open") $('#close_dialog_pl').click(function() { pl_dialog.dialog("close") }) $('#add_player').click(function() { var data = $('#AddForm').serialize() $.post("/Group/Players/player_save", {data:data}) }) } }); }); 

Here is the controller code

 function player_save() { if (!empty($this -> request -> data)) { $this -> Player -> save($this -> request -> data); } } 

    1 answer 1

     $.post("/Group/Players/player_save",{data:data}) 

    instead, it is better to use $ .ajax ({}) and look at the error in the console, and when saving in this case, try this

     $this->Player->save($this->request->data['User']); 

    change the name of the User to the name of the controller where the data goes; moreover, the name public is possible and should be added before the function ()