[wp-trac] [WordPress Trac] #11015: Admin Ajax actions should pass relevant global variables

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 18 01:39:30 UTC 2009


#11015: Admin Ajax actions should pass relevant global variables
-------------------------+--------------------------------------------------
 Reporter:  filosofo     |       Owner:  ryan                
     Type:  enhancement  |      Status:  new                 
 Priority:  normal       |   Milestone:  2.9                 
Component:  JavaScript   |     Version:  2.9                 
 Severity:  normal       |    Keywords:  admin-ajax has-patch
-------------------------+--------------------------------------------------

Comment(by filosofo):

 Replying to [comment:2 azaozz]:
 > -1. Don't see the benefit in doing this.

 The benefit is
  * You don't have to access global objects in your callback
  * You can be agnostic about whether the "action" is from POST or GET.
  * Testing is more straightforward.
  * There's no harm.

 This helps avoid having to check whether "action" is set in POST or GET,
 and it allows code reuse: I can use the same callback in different places.

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


More information about the wp-trac mailing list