=head1 NAME Mojolicious::Plugin::ISAjax - XMLHttpRequest Detection Plugin =head1 SYNOPSIS # Mojolicious $self->plugin('ISAjax'); # Mojolicious::Lite plugin 'ISAjax'; # Example of usage in a template % if ( isajax ) { % layout 'ajax'; % } else { % layout 'default'; % } # Example of usage in a controller return $self->render(template => 'foo/ajax') if $self->isajax; =head1 DESCRIPTION Distinguish between normal requests and Ajax requests by checking C string in C header and set stash value for C accordingly. Also exports C helper. L is a L plugin. =head1 OPTIONS =head2 C # Mojolicious $self->plugin('ISAjax' => {stash => 'ajax'}); # Mojolicious::Lite plugin 'ISAjax' => {stash => 'ajax'}; Stash name for Ajax flag, defaults to C. =head1 HELPERS =head2 C % if ( isajax ) {

Hello from Ajax Request

% } $self->isajax; Returns C<1> in case of an Ajax request. Otherwise returns C. =head1 METHODS L inherits all methods from L and implements the following new ones. =head2 C $plugin->register; Register plugin in L application. =head1 SEE ALSO L, L, L. =cut