Answers.Body: <p>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.</p>
  
  <p>But if anyone knows how to call console controllers directly, please tell me.Thx</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-16T04:29:17.333Z
Answers.LastActivityDate: 2018-08-16T04:29:17.333Z
Answers.UserDisplayName: yu xia
Body: <p>I have a controller in the console folder. How can I call this controller via ajax please?</p>
  
  <p>I tried to config a route in <code>Routes.php</code>, and then call this route by jquery <code>Get()</code> function. But none of these below work...</p>
  
  <pre><code>'api/v0/hub-loader/&lt;sheet_id:\d+&gt;' =&gt; 'craftplugin/import-hubs/test',
  'api/v0/hub-loader/&lt;sheet_id:\d+&gt;' =&gt; 'craftplugin/console/controllers/import-hubs/test',
  'api/v0/hub-loader/&lt;sheet_id:\d+&gt;' =&gt; 'craftplugin/console/import-hubs/test',
  </code></pre>
  
  <p>All these routes return <code>404 page not found error</code></p>
  
Tags: <plugin-development><ajax><controller><console>
Title: How can I call console controllers
ThreadText: # How can I call console controllers
  
  (Asked by: username_0 on 2018-08-16)
  
  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`
  
  **Tags:** plugin-development, ajax, controller, console
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-08-16. Score: 1 | Accepted answer
  
  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
  
  
  ---
  
  