how to remove preformated text
I've wrote in the module: print $callback . '(' . $json . '); and I've got 'dancer'respond on a browser: somfunc({ "items" : [ "a", "b", "c", "d" ] } );HTTP/1.0 200 OK Server: Perl Dancer 1.3099 Content-Length: 1 Content-Type: text/html; charset=utf-8 X-Powered-By: Perl Dancer 1.3099 1 how to remove preformated text "HTTP/1.0 200 OK...."from the end? thank in advance just a begginer /Sigis Dagis
On Tue, 4 Sep 2012 21:41:55 +0000 Sigis Dagilis <sigidagi@hotmail.com> wrote:
I've wrote in the module:
What module? Your Dancer app?
print $callback . '(' . $json . ');
If that's in a route handler, you want to return the content to be passed to the user's browser, not print it.
and I've got 'dancer'respond on a browser:
somfunc({ "items" : [ "a", "b", "c", "d" ] } );HTTP/1.0 200 OK Server: Perl Dancer 1.3099 Content-Length: 1 Content-Type: text/html; charset=utf-8 X-Powered-By: Perl Dancer 1.3099
1
That's.... weird. Anyway, change your route handler to return the content instead of calling print: get '/foo' => sub { return "$callback($json);"; }; ... and all should be well. (The reason the response had a Content-Length of "1", and consisted of just "1", was because your route handler was returning the result of the print call as the response content.)
just a begginer
Welcome to the Dancer community :) -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
participants (2)
-
David Precious -
Sigis Dagilis