Update documentation to show Rsx.Route() pattern for Ajax calls

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-31 04:44:11 +00:00
parent 91bb6e9bef
commit 393479280f
4 changed files with 10 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ class DirectAjaxApi_CodeQualityRule extends CodeQualityRule_Abstract
* Should use:
* await Controller.action(params)
* Or:
* await Ajax.call('Controller', 'action', params)
* await Ajax.call(Rsx.Route('Controller', 'action'), params)
*/
public function check(string $file_path, string $contents, array $metadata = []): void
{

View File

@@ -88,11 +88,13 @@ Behind the scenes, the stub translates to:
```javascript
class Demo_Index_Controller {
static async hello_world(...args) {
return Ajax.call('Demo_Index_Controller', 'hello_world', args);
return Ajax.call(Rsx.Route('Demo_Index_Controller', 'hello_world'), args);
}
}
```
Note: `Rsx.Route()` generates type-safe URLs like `/_ajax/Demo_Index_Controller/hello_world`.
### Response Format
Success responses:

View File

@@ -269,10 +269,12 @@ JAVASCRIPT STUBS
// Automatically included in bundles
class User_Controller {
static async get_profile(...args) {
return Ajax.call('User_Controller', 'get_profile', args);
return Ajax.call(Rsx.Route('User_Controller', 'get_profile'), args);
}
}
Note: Rsx.Route() generates type-safe URLs like /_ajax/User_Controller/get_profile
Models with fetch() methods get stubs:
class User_Model {
static async fetch(id) {

View File

@@ -248,12 +248,14 @@ JAVASCRIPT STUB GENERATION
class User_Controller {
static async search(...args) {
return Ajax.call('User_Controller', 'search', args);
return Ajax.call(Rsx.Route('User_Controller', 'search'), args);
}
}
Stubs included automatically in bundles.
Note: Rsx.Route() generates type-safe URLs like /_ajax/User_Controller/search
CALLING API METHODS
From JavaScript:
// Single argument