[wp-trac] [WordPress Trac] #14618: Proposal: Standardize WP Responses to JS Requests as JSON

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 25 22:41:33 UTC 2010


#14618: Proposal: Standardize WP Responses to JS Requests as JSON
-------------------------+--------------------------------------------------
 Reporter:  filosofo     |       Owner:                
     Type:  enhancement  |      Status:  new           
 Priority:  normal       |   Milestone:  Future Release
Component:  JavaScript   |     Version:  3.0           
 Severity:  normal       |    Keywords:  needs-patch   
-------------------------+--------------------------------------------------

Comment(by josephscott):

 Replying to [comment:14 filosofo]:
 > What is the current use case in which you're posting binary data via
 XHR?

 Uploading images (or any other media file) is the obvious target.  Also,
 any generalized API like the one proposed will not be limited to just XHR
 use.

 >
 > You could easily add an argument to the endpoint to indicate version:
 > {{{
 > admin-ajax.php?json-api=1.0
 > }}}
 > or pass it as one of the JSON parameters (`{json-api-version: "1.0"}`).

 True, I should have been more specific, I was thinking of per method
 versions.

 >  * Standardization: I don't have to worry about any other Ajax
 functionality or libraries: I just check for the JS methods and call them
 if available.
 >  * Consistent Response Handling: Responses can be only one of the
 following:
 >    * Syntactically invalid response (this includes blank responses)
 >    * Successful response
 >    * Error response

 I don't see that any of these reasons require an RPC approach.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14618#comment:16>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list