PHP code example of eltharin / ajaxresponser

1. Go to this page and download the library: Download eltharin/ajaxresponser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eltharin / ajaxresponser example snippets

 php
use Eltharin\AjaxResponserBundle\Annotations\AjaxCallOrNot;

...

#[Route(path: '/test-ajax-responser', name: 'app_test_ajax_responser')]
#[AjaxCallOrNot]
public function test_ajax_responser(): Response
{
    //-- Actions

    $this->addFlash('success', 'all is good');

    return $this->redirectToRoute('app_home');
}
 php
use Eltharin\AjaxResponserBundle\Annotations\AjaxCallOrNot;

...

#[Route(path: '/test-ajax-responser', name: 'app_test_ajax_responser')]
#[AjaxCallOrNot(getRedirectContent: false)]
public function test_ajax_responser(): Response
{
    //-- Actions

    $this->addFlash('success', 'all is good');

    return $this->redirectToRoute('app_home');
}