Dancer
view release on metacpan or search on metacpan
lib/Dancer/Plugin/Ajax.pm view on Meta::CPAN
}
any ['get', 'post'] => $pattern, @compiled_rest;
}
register_plugin;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Dancer::Plugin::Ajax - a plugin for adding Ajax route handlers
=head1 VERSION
version 1.3522
=head1 SYNOPSIS
package MyWebApp;
use Dancer;
use Dancer::Plugin::Ajax;
ajax '/check_for_update' => sub {
# ... some Ajax code
};
dance;
=head1 DESCRIPTION
The C<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:
=over 4
=item *
Pass if the request header X-Requested-With doesn't equal XMLHttpRequest
=item *
Disable the layout
=item *
The action built matches POST / GET requests.
=back
=head1 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'
=head1 AUTHOR
This module has been written by Alexis Sukrieh <sukria@sukria.net>
=head1 AUTHOR
Dancer Core Developers
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 0.510 second using v1.01-cache-2.11-cpan-524268b4103 )