mdo:ajax ( [ validator, ] [ param-name-1, param-value-1 [ , ...n ] ] )

mdo:ajax assigns values to parameters and calls XsltDb ajax handler to reexecute XSLT. After XSLT result is downloaded on the client it injected into HTML DOM instead of current module content. Actually mdo:ajax creates a javascript that operates in the client browser so the result of mdo:ajax should be injected into javascript: event handler, javascript function or anchor href attribute.
  • validator is the name of a javascript function that is called before data is ajax'ed to server. The function must return true or false. If false ajax call is not performed.

Value of parameter 'test':
<xsl:value-of select="mdo:param('test')" /><br />
<a href="javascript:{mdo:ajax('test', mdo:param('test', 0) + 1)}">Increase</a>
There is also a shot form mdo:jajax(...) that adds a "javascript:" prefix to be used directly in href context:

Value of parameter 'test':
<xsl:value-of select="mdo:param('test')" /><br />
<a href="{mdo:jajax('test', mdo:param('test', 0) + 1)}">Increase</a>

XsltDb uses SEO-friendly ajax technology. In case of page reload all modules are rendered in common way and search engine gets all content within HTML. So it will always get content of first page even if everithing is using ajax. Moreover in next releases you will be able to setup rules to recognize search engines and all mdo:ajax-es will act as mdo:navigate.

See also:

Last edited Dec 2, 2009 at 3:48 PM by findy, version 6


No comments yet.