Dear List,
I wondered whether anyone could shed some light on what happens during the
flow of a request, there seems to be a difference in returning directly from
the controller and forwarding to a view. This effect is show when using
Ajax.
This issue only appears in IE7, Firefox handles the response from the
request fine.
The situation is a s follows;
I have two javascript Updater methods in a page;
<html>
<head>
<script src="/javascript/scriptaculous-js-1.8.0/lib/prototype.js"
type="text/javascript"></script>
<script src="/javascript/scriptaculous-js-1.8.0 /src/scriptaculous.js"
type="text/javascript"></script>
</head>
<body>
....
<a onclick=" if ( Ajax.getTransport() ){ new
Ajax.Updater('securityInfo','/updater/timeMason',
{ evalScripts: true }); return false; }" href="#testanchor">Method A</a>
<a onclick=" if ( Ajax.getTransport() ){ new
Ajax.Updater('securityInfo','/updater/time',
{ evalScripts: true }); return false; }" href="#testanchor">Method B</a>
One of the ajax requests (Method A) calls a catalyst method that forwards to
a Mason view the other request (Method B) calls a catalyst method that
returns from the controller using: $c->response->body
the controllers;
Method A
sub timeMason : Local {
my ($self, $c) = @_;
$c->stash->{template} = 'updaterPages/timeMason.mhtml';
$c->forward( $c->view('Mason') ) unless $c->response->body;
}
Method B
sub time : Local {
my ($self, $c) = @_;
$c->response->body("Updater ran @ ".localtime);
}
The mason page root/updaterPages/timeMason.mhtml contains :
<% "Updater ran @ ".localtime %>
In IE7 when you run the controllers directly ie http://host/updater/time and
http://host/updater/timeMason the correct output is displayed, they both
work.
The problem is that in IE7, when run from the Javascript Updater, only
method B works the javascript fails when attempting to get the responseText
from the transport (in prototype.js line: this.responseText =
String.interpret(transport.responseText ). The examples I have seen using
AJAX with catalyst all seem to have the controller setting the response body
(method B). Is it possible to use method A?
Thanks in advance
Stephen
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/