Request Ajax Code:

$.ajax({ type: "POST", data: { confirm: 'dfsfdsfsd' }, url: "<?php echo $this->createUrl('article_tag/update'); ?>", }); 

For some magical reason, $_POST['confirm'] does not exist in Article_tagController->actionUpdate() . Does anyone have any idea what could be the problem?

  • First you need to make sure that the request comes to this action. The naming of article_tag and Article_tagController is incorrect. Must have ArticleTagController and article-tag / update - Embarcadero
  • After 1) url do not leave a comma, 2) write something in actionUpdate (echo 1111). 3) Look in the Console-> Network-> Response if you see your 1111 then everything is in order, Change the jquery library. If there is no, make sure that the path to the actionUpdate is registered correctly - Vanya Avchyan
  • data: JSON.stringify({ confirm: 'dfsfdsfsd' }), - E_p
  • The request to the action should go the way the worker is. In addition, this path is specified in the form action and everything is ok. The action itself is also a worker. I don’t even know what else to complain about - Jeque
  • There was the same problem, for POST, PUT you must first convert to a string. + 'contentType': 'application/json; charset=utf8' 'contentType': 'application/json; charset=utf8' - E_p

0