Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: Embperl

Setting status code

 

 

ModPerl embperl RSS feed   Index | Next | Previous | View Threaded


embperl at thefreecat

Sep 26, 2012, 2:48 PM

Post #1 of 2 (344 views)
Permalink
Setting status code

Hello,

I'm calling a page with jQuery's $.ajax() and I want it to return a
status code (201 if ok, 400 if some parameters are missing). The goal is
to use .done() and .fail()

I guess that's the way to go but apart when doing redirects (with
$http_header_out('location',['/page',302]) )I don't know how to set a
HTTP status code from embperl.

I thought exit 400 would work but it seems not. $req->status(400) does
not exist (anymore?)

Thanks for your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe [at] perl
For additional commands, e-mail: embperl-help [at] perl


richter at ecos

Oct 3, 2012, 2:59 AM

Post #2 of 2 (315 views)
Permalink
RE: Setting status code [In reply to]

Exit (400) should work, but you need to set optReturnError (see http://www.embperl.org/embperl/pod/doc/Config.-page-2-.htm#sect_43)

Gerald


> -----Original Message-----
> From: Jean-Christophe Boggio [mailto:embperl [at] thefreecat]
> Sent: Wednesday, September 26, 2012 11:48 PM
> To: embperl [at] perl
> Subject: Setting status code
>
> Hello,
>
> I'm calling a page with jQuery's $.ajax() and I want it to return a status code
> (201 if ok, 400 if some parameters are missing). The goal is to use .done() and
> .fail()
>
> I guess that's the way to go but apart when doing redirects (with
> $http_header_out('location',['/page',302]) )I don't know how to set a HTTP
> status code from embperl.
>
> I thought exit 400 would work but it seems not. $req->status(400) does not
> exist (anymore?)
>
> Thanks for your help.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe [at] perl
> For additional commands, e-mail: embperl-help [at] perl



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe [at] perl
For additional commands, e-mail: embperl-help [at] perl

ModPerl embperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.