Changeset 2055

Show
Ignore:
Timestamp:
10/26/06 17:36:19
Author:
miyagawa
Message:

support X-JSON, updated the doc

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Catalyst-View-JSON/trunk/lib/Catalyst/View/JSON.pm

    r1901 r2055  
    9494    } 
    9595 
     96    if ($c->req->header('X-Prototype-Version')) { 
     97        $c->res->header('X-JSON' => 'eval("("+this.transport.responseText+")")'); 
     98    } 
     99 
    96100    my $output; 
    97101    $output .= "$cb(" if $cb; 
     
    278282recommened approach is to use Catalyst::View::JSON which will JSON 
    279283format all the response data and return it in the response body. 
    280 The response body can then be evaled on the client using the 
     284In at least prototype 1.5.0 rc0 and above, prototype.js will send 
     285the X-Prototype-Version header. If this is encountered, a JavaScript 
     286eval will be returned in the X-JSON resonse header to automatically 
     287eval the response body. If your version of prototype does not send 
     288this header, you can manually eval the response body using the 
    281289following JavaScript: 
    282290