1

I have a controller in the console folder. How can I call this controller via ajax please?

I tried to config a route in Routes.php, and then call this route by jquery Get() function. But none of these below work...

'api/v0/hub-loader/<sheet_id:\d+>' => 'craftplugin/import-hubs/test',
'api/v0/hub-loader/<sheet_id:\d+>' => 'craftplugin/console/controllers/import-hubs/test',
'api/v0/hub-loader/<sheet_id:\d+>' => 'craftplugin/console/import-hubs/test',

All these routes return 404 page not found error

1

I found a way to get around this problem by creating a controller which extends the console controller. Then I can call the functions in this child controller.

But if anyone knows how to call console controllers directly, please tell me.Thx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.