[wp-trac] [WordPress Trac] #22918: Allow to include ajax url javascript argument in the template header

WordPress Trac noreply at wordpress.org
Wed Dec 19 02:52:59 UTC 2012


#22918: Allow to include ajax url javascript argument in the template header
-------------------------+------------------------------
 Reporter:  alexvorn2    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Template     |     Version:  3.5
 Severity:  normal       |  Resolution:
 Keywords:  close        |
-------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:   => close


Comment:

 The code in question: [[BR]]
 http://core.trac.wordpress.org/browser/tags/3.5/wp-admin/admin-
 header.php#L51

 * `wp_enqueue_script()` won't be enough, we would also need
 `wp_localize_script()` to set those values.
 * Those variables are intended to be accessible throughout the admin, so
 hard-coding them in `admin-header.php` makes sense to me.
 * `ajaxurl` on the front end should also be set via
 `wp_localize_script()`: [[BR]]
  http://codex.wordpress.org/AJAX_in_Plugins#Ajax_on_the_Viewer-Facing_Side

 So, `wp_enqueue_script('load-ajax-url')` alone doesn't seem feasible.

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


More information about the wp-trac mailing list