Hi,
V. simple app:
package MyApp;
use Dancer ':syntax';
use Dancer::Plugin::Ajax;
ajax '/hellox/:name' => sub {
template 'hello';
};
true;
Produces:
Which is to be expected.
But:
package MyApp;
use Dancer ':syntax';
use Dancer::Plugin::Ajax;
ajax '/hellox/:name' => sub {
Dancer::Config::setting('appdir',$ENV{ROOT});
Dancer::Config::load();
template 'hello';
};
true;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<head></head>
<body>
<p>This is hello</p>
</body>
</html>
So, running Dancer::Config::load() stops Plugin::Ajax working.
This may seems a strange thing to do, but for me the load() was deep in a module that some times runs outside of Dancer but picks up stuff from the Dancer config.
Handling the ajax call manually (as per the the Cookbox) there are no problems with using load().
Stephen