The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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>