cubicweb.ajax.js — CubicWeb 3.10.1

### Navigation

- index
- modules |
- next |
- previous |
- CubicWeb 3.10.1 »
- Web side development »
- Javascript »
- <no title> »

# cubicweb.ajax.js

`cubicweb.ajax.js.` `Deferred`()

dummy ultra minimalist implementation of deferred for jQuery

`function loadAjaxHtmlHead(response)`

inspect dom response (as returned by getDomFromResponse), search for a <div class=”ajaxHtmlHead”> node and put its content into the real document’s head. This enables dynamic css and js loading and is used by replacePageChunk

`cubicweb.ajax.js.` `ajaxFuncArgs`(fname, form, *args)

extend form parameters to call the js_`fname` function of the json controller with args arguments.

`cubicweb.ajax.js.` `loadxhtml`(url, form, reqtype='get', mode='replace', cursor=true)

build url given by absolute or relative url and form parameters (dictionary), fetch it using reqtype method, then evaluate the returned XHTML and insert it according to mode in the document. Possible modes are :

> - ‘replace’ to replace the node’s content with the generated HTML
> - ‘swap’ to replace the node itself with the generated HTML
> - ‘append’ to append the generated HTML to the node’s content

If cursor, turn mouse cursor into ‘progress’ cursor until the remote call is back.

`cubicweb.ajax.js.` `loadRemote`(url, form, reqtype='GET', sync=false)

Asynchronously (unless async argument is set to false) load an url or path and return a deferred whose callbacks args are decoded according to the Content-Type response header. form should be additional form params dictionary, reqtype the HTTP request type (get ‘GET’ or ‘POST’).

`cubicweb.ajax.js.` `_`(message)

emulation of gettext’s _ shortcut

`cubicweb.ajax.js.` `_loadDynamicFragments`(node)

finds each dynamic fragment in the page and executes the the associated RQL to build them (Async call)

`cubicweb.ajax.js.` `unregisterUserCallback`(cbname)

unregisters the python function registered on the server’s side while the page was generated.

`cubicweb.ajax.js.` `buildWysiwygEditors`(parent)

XXX: this function should go in edition.js but as for now, htmlReplace references it.

replace all textareas with fckeditors.

`cubicweb.ajax.js.` `stripEmptyTextNodes`(nodelist)

takes a list of DOM nodes and removes all empty text nodes

`cubicweb.ajax.js.` `getDomFromResponse`(response)

convenience function that returns a DOM node based on req’s result. XXX clarify the need to clone

### Navigation

- index
- modules |
- next |
- previous |
- CubicWeb 3.10.1 »
- Web side development »
- Javascript »
- <no title> »