rlang  Wed, 11 Apr 2018 05:55:42 +0000

Modified page: https://wiki.horde.org/Doc/Dev/HordeAjaxApplications
New Revision:  11
Change log:  Some more details on HordeCore.doAction workflow

@@ -40,8 +40,42 @@

[http://dev.horde.org/api/master/lib/Core/classes/Horde_Core_Ajax_Application.html Horde_Core_Ajax_Application documentation]
++++ Making an ajax call to Horde
+Implement $App_Ajax_Application and load at least one handler class $App_Ajax_Application_Handler in the _init function.
+Call HordeCore.doAction(action, params, opts) from JS:
+action is corresponding to one method name in one of the loaded handlers.
+options is a json object with parameters.
+doAction takes care of authentication details transparently.
+Real Life Example:
+  HordeCore.doAction('searchEvents', {
+                cals: Object.toJSON(cals),
+                query: query,
+                time: this.search
+}, {
+ callback: function(r) {
+The handlers have no parameters. They expect named parameters in $this->vars->$name corresponding to the params in the doAction call's second argument.
+Return values:
+Normally, you would return an array structure of serializable data. It will automatically be sent to browser as a json structure. You can also return a string (like HTML) or a Horde_Core_Ajax_Response object for more advanced use cases.

 +++ Application-specific javascript code

Most apps which sport completely distinct dynamic and traditional views (kronolith, hermes) also have $app/js/$app.js

commits mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: commits-unsubscr...@lists.horde.org

Reply via email to