Identifier "ajax" Is Not Defined

I am developing a new addon. I want to use ajax. When I try to use ajax in $mode in PHP I get the error below:

PHP Fatal error:  Uncaught InvalidArgumentException: Identifier "ajax" is not defined. in C:\wamp64\www\app\lib\vendor\pimple\pimple\src\Pimple\Container.php:95

How can I identify "AJAX"?


Show a part of your addon code

Best regards


If you run URL in your browser without using ajax, you will see such error.

Hi i have this error in checkout page i use addon and use version 4.10.4.sp1 . Can anyone help for this. When click "place order" button wants to goes order recieved page. But gives error. thanks for all
PHP Fatal Error
Uncaught Pimple\Exception\UnknownIdentifierException: Identifier "ajax" is not defined. in /var/www/vhosts/
Stack trace:
#0 /var/www/vhosts/ Pimple\Container->offsetGet('ajax')
#1 /var/www/vhosts/ include('/var/www/vhosts...')
#2 /var/www/vhosts/ fn_start_payment(96, Array, Array)
#3 /var/www/vhosts/ fn_checkout_place_order(Array, Array, Array)
#4 /var/www/vhosts/ include('/var/www/vhosts...')
#5 /var/www/vhosts/ fn_run_controller('/var/www/vhosts...', 'checkout', 'place_order', '', '')
#6 /var/www/vhosts/ fn_dispatch()
#7 {main}
Error at
app/lib/vendor/pimple/pimple/src/Pimple/Container.php, line: 101
And banks.php in it
47 exit;
48 }else{
50 $redirect = fn_url("payment_notification.response?payment=banks&order_id={$order_info['order_id']}", AREA);
51 Tygh::$app['ajax']->assign('force_redirection', $redirect);
52 exit;

It is better to contact developers of the Banks addon with this issue.

As alternative try to replace

Tygh::$app['ajax']->assign('force_redirection', $redirect);


if (defined('AJAX_REQUEST')) {
    Tygh::$app['ajax']->assign('force_redirection', $redirect);
} else {

Hi ecom thanks for all it works well

You are welcome!