*   \   &   ©   |   /   * *   \   &   ©   |   /   * *   \   &   ©   |   /   * *   \   &   ©   |   /   * *   \   &   ©   |   /   *

Textpattern plugin: dub_if_ajax

<txp:dub_if_ajax>, a small helper tag that tests if the current page is being called via an XMLHttpRequest. Works great with jQuery or Prototype, which publish the needed HTTP_X_REQUESTED_WITH header — YMMV.

This can be used so that pages my be pulled in via AJAX or displayed on their own with minimal effort. I generally put it at the top of a page, only outputting page layout elements if it’s not being called by AJAX.

  • Web 2.0 friendly
  • SEO friendly
  • Buzzword friendly
  • 3 lines of code; hundreds of lines of documentation & promotion

Download

Usage

<txp:dub_if_ajax>
This code is being called from an AJAX function. Just output the article, etc.
<txp:else />
Regular page. Add visual fluff.
</txp:dub_if_ajax>

Demo

Check out the demo



Comment on this

Commenting is closed for this article.