'Open cart 2 how to call a model method in a helper php file

I created a php file in helper which i call with ajax when a certain button is pressed. The ajax call works correctly. What i want to know is how to call a model method in a php file in helper, so that it executes when the button is pressed. The code of the php file is the following.

function ac() {
            $this->load->model('total/coupon');

            $this->model_total_coupon->coupon_test();
                }
        
        if (isset($_POST['action'])) {
        switch ($_POST['action']) {
            case 'ΕΓΓΡΑΦΗ':
                ac();
                
                break;
        }
    }

calling the model the way i do in the function ac() is wrong apparently. How should i do this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source