E
E
EVOSandru62015-10-05 06:38:12
JavaScript
EVOSandru6, 2015-10-05 06:38:12

How to address and correctly accept Ajax requests in Yii within a single action?

Good afternoon, 1. There is a need to accept several Ajax requests

within the current action . In the case of a single request, everything is clear:

if (Yii::app()->request->isAjaxRequest)
    {
      $this->renderPartial('_loopAjax', // _loop
      [
        '_request'=>Yii::app()->request,
        'dataProvider'=>$dataProvider,
      ]);
      Yii::app()->end();
    }
    else
    {
      $this->render('index',
      [
        'dataProvider'=>$dataProvider,
      ]);
    }


How can this be implemented given that there can be several get and post requests?

2. And I’m also interested in the moment, if using Jquery Ajax I generate a content block depending on the menu item I poke on, is there a way to transfer authority to another action (or controller / action ) when displaying certain content, and not stay within the current one?

3. If 2. , then is there a way to go back to the current one?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question