NAME
Plack::Middleware::Debug::Ajax - Show log of ajax requests/responses
VERSION
version 0.02
SYNOPSIS
To activate this panel:
builder {
enable 'Debug', panels =>
[
qw(Parameters Memory),
[ 'Ajax',
log_limit => 100,
]
];
$app;
}
If you're using Dancer, you can enable the panel via your config.yml:
plack_middlewares:
-
- Debug
- panels
-
- Parameters
- Memory
- Ajax
DESCRIPTION
Adds a debug panel that logs ajax requests and responses through jQuery, as they happen. Only ajax requests that go through jQuery are logged, because the logging relies on jQuery's global event handlers. If you make an ajax call with global set to false, the event won't be logged:
$.ajax({
// ...
global: false,
});
You could use this feature to selectively log messages, if you don't make use of global ajax event handlers elsewhere.
Note that ajax events are logged as they happen, so responses won't necessarily appear directly above their respective requests. Events are shown newest first.
SETTINGS
- log_limit
-
Limit the number of logged ajax requests and responses to the specified number. When the log exceeds this size, the oldest items are deleted to make room for new items. The default limit is 50, to avoid hogging memory with large responses.
STANDALONE DEMO
There is a complete standalone demo of the Ajax panel in the source of this distribution. To run the demo, download the tarball for this distribution, extract it, cd into it, and run:
$ plackup sample/app.psgi
Then point your browser to:
http://0:5000/
And play around with it.
JQUERY VERSIONS
Requires jQuery 1.4 or later for full functionality, and has been tested with the following versions:
It mostly works with jQuery 1.1 and greater, and doesn't work at all with jQuery 1.0.
BUGS
Report any bugs via http://rt.cpan.org. Pull requests welcome on github: http://github.com/doublecreations/plack-middleware-debug-ajax/
AUTHOR
Vincent Launchbury <vincent@cpan.org>
COPYRIGHT
Copyright (C) 2013 Vincent Launchbury
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.