diff --git a/e107_files/jslib/core/dialog.js b/e107_files/jslib/core/dialog.js index f42948b6f..cdd517126 100644 --- a/e107_files/jslib/core/dialog.js +++ b/e107_files/jslib/core/dialog.js @@ -75,14 +75,57 @@ e107Base.setPrefs('core-dialog', { * }).center({top: 30}).setHeader(target.readAttribute('title')).setContent(source.innerHTML).activate().show(); * }); * - * // AJAX example + * // AJAX example, call to http://yoursite.com/e107_plugins/myplugin/myAjaxScript.php?id=someId * new e107Widgets.Dialog({ * id: 'unique-window-id', * width: 400, * height: 300 - * }).setAjaxContent(url, roptions)..center({top: 30}).activate().show(); + * }).setAjaxContent(('#{e_PLUGIN}myplugin/myAjaxScript.php').parsePath(), { + * method: 'get', + * params: { id: 'someId' } + * }).center({top: 30}).activate().show(); * * + * Example JSON response from e107_plugins/myplugin/myAjaxScript.php + * + * buildJsonResponse($ret); + * $jshelper->sendJsonResponse(null); + * + * + * PREFFERED WAY - Example JSON response within a controller (single entry point) + * File: e107_plugins/myplugin/controllers/ajax.php + * URL: http://yoursite.com/myplugin/ajax + * + * addTitle('My page title', false); + * $this->addBody('My page body'); + * + * // optional - override and/or add footer information + * $more = array('footer' => 'Footer details'); + * + * // send the response + * $this->getResponse() + * ->sendJson($more); + * } + * } + * + * * e107Widgets.Dialog#setAjaxContent() Options: * Any valid e107Ajax.Request() options + additional 'onAfterComplete' callback *