Scroll to navigation

Dancer::Plugin::Ajax(3pm) User Contributed Perl Documentation Dancer::Plugin::Ajax(3pm)

NAME

Dancer::Plugin::Ajax - a plugin for adding Ajax route handlers

SYNOPSIS

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

DESCRIPTION

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 doesnt equal XMLHttpRequest
Disable the layout
The action built is a POST request.

AUTHOR

This module has been written by Alexis Sukrieh <sukria@sukria.net>
2012-03-31 perl v5.14.2