========== JavaScript ========== .. sectionauthor:: Bernhard Posselt The JavaScript files reside in the **js/** folder and should be included in the template: .. code-block:: php `_. A nice tutorial screencast collection can be found on `Egghead.io `_ Sending the CSRF token ====================== If any other JavaScript request library than jQuery is being used, the requests need to send the CSRF token as an HTTP header named **requesttoken**. The token is available in the global variable **oc_requesttoken**. For AngularJS the following lines would need to be added: .. code-block:: js var app = angular.module('MyApp', [).config(['$httpProvider', function($httpProvider) { $httpProvider.defaults.headers.common.requesttoken = oc_requesttoken; }]); Generating URLs =============== To send requests to ownCloud the base URL where ownCloud is currently running is needed. To get the base URL use: .. code-block:: js var baseUrl = OC.generateUrl(''); Full URLs can be genrated by using: .. code-block:: js var authorUrl = OC.generateUrl('/apps/myapp/authors/1');