I've been converting some apps called by CGI::Application::Dispatch to
run in an Ajax-y way. I've been going along ok with CGI::Ajax, but I was
intrigued by the Jemplate module for Javascript Templating with Template
Toolkit, which I first saw mentioned in this list
(http://search.cpan.org/~ingy/Jemplate-0.17/lib/Jemplate.pm/
The templating part of this works very well. However, the latest release
(2/28/06) includes Ajax support, so I thought I should try that. Arrgh,
there are only two methods, and I can't get either to work :-(
Ajax.get is supposed to work like this:
Ajax.get(url, [callback]);
in my test page there is this JS:
function handleRequest(){
alert(arguments[0]);
}
function testAjax(){
Ajax.get('admin.pl/clients/testAjax', handleRequest);
}
in Clients.pm I have runmode testAjax:
sub testAjax{
my $self=shift;
use JSON;
return objToJson( { myKey => "myValue" } );
}
But textAjax throws this javascript error:
Error: [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult:
"0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
http://localhost/public_html/cgi-bin/admin/jemp/Jemplate.js :: anonymous
:: line 558" data: no]
Source File: http://localhost/public_html/cgi-bin/admin/jemp/Jemplate.js
Line: 558
I didn't have any better luck with the other method,
Ajax.post(url, data, [callback]);
because I couldn't come up with a format for "data" that worked (tried
things like document.forms[0], js objs, stringified objs, etc.
I'm sure this is pretty elementary stuff (and not really
CGI::Application related -- sorry). I'm hoping someone here can point me
in the right direction
Thx,
Bruce
--
Bruce McKenzie
http://www.2MinuteExplainer.com
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]