Dancer::Plugin::Ajax(3pm)

Dancer::Plugin::Ajax3pm

A plugin for adding ajax route handlers

Usage

    package MyWebApp;
    use Dancer;
    use Dancer::Plugin::Ajax;
    ajax '/check_for_update' => sub {
        # ... some Ajax code
    };
    dance;

Version

version 1.3521

Overview

The "ajax" keyword which is exported by this plugin allow you to define a route handler optimized for Ajax queries.

The route handler code will be compiled to behave like the following:

•

Pass if the request header X-Requested-With doesn't equal XMLHttpRequest

•

Disable the layout

•

The action built matches POST / GET requests.

Configuration

By default the plugin will use a content-type of 'text/xml' but this can be overwritten with plugin setting 'content_type'.

Here is example to use JSON:

  plugins:
    'Ajax':
      content_type: 'application/json'

Releases

7 releases since Debian 7 (Wheezy); the text changed 5 times.

  1. 7
  2. 8
  3. 9
  4. 10
  5. 11
  6. 12–13

Author

This module has been written by Alexis Sukrieh <[email protected]>

Author

Dancer Core Developers

From libdancer-perl 1.3521+dfsg-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.