Changeset 1841

Show
Ignore:
Timestamp:
06/11/06 01:36:57
Author:
miyagawa
Message:

apply doc patch from jwang

Files:

Legend:

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

    r1805 r1841  
    253253L<http://developer.yahoo.net/common/json.html> 
    254254 
     255=head1 INTEROPERABILITY 
     256 
     257JSON use is still developing and has not been standardized. This 
     258section provides some notes on various libraries. 
     259 
     260Dojo Toolkit: Setting dojo.io.bind's mimetype to 'text/json' in 
     261the JavaScript request will instruct dojo.io.bind to expect JSON 
     262data in the response body and auto-eval it. Dojo ignores the 
     263server response Content-Type. This works transparently with 
     264Catalyst::View::JSON. 
     265 
     266Prototype.js: prototype.js will auto-eval JSON data that is 
     267returned in the custom X-JSON header. The reason given for this is 
     268to allow a separate HTML fragment in the response body, however 
     269this of limited use because IE 6 has a max header length that will 
     270cause the JSON evaluation to silently fail when reached. The 
     271recommened approach is to use Catalyst::View::JSON which will JSON 
     272format all the response data and return it in the response body. 
     273The response body can then be evaled on the client using the 
     274following JavaScript: 
     275 
     276  evalJSON: function(request) { 
     277    try { 
     278      return eval('(' + request.responseText + ')'); 
     279    } catch (e) {} 
     280  } 
     281  // elsewhere 
     282  var json = this.evalJSON(request); 
     283 
    255284=head1 AUTHOR 
    256285