Make WordPress Core


Ignore:
Timestamp:
07/11/2013 12:20:36 AM (13 years ago)
Author:
nacin
Message:

Rename wp.xhr to wp.ajax to match admin-ajax.php (which it uses), jQuery.ajax (which it wraps), etc. see #24424.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/wp-util.js

    r24369 r24652  
    2929    });
    3030
    31     // wp.xhr
     31    // wp.ajax
    3232    // ------
    3333    //
    3434    // Tools for sending ajax requests with JSON responses and built in error handling.
    3535    // Mirrors and wraps jQuery's ajax APIs.
    36     wp.xhr = {
    37         settings: settings.xhr || {},
     36    wp.ajax = {
     37        settings: settings.ajax || {},
    3838
    3939        /**
    40          * wp.xhr.post( [action], [data] )
     40         * wp.ajax.post( [action], [data] )
    4141         *
    4242         * Sends a POST request to WordPress.
     
    4747         */
    4848        post: function( action, data ) {
    49             return wp.xhr.send({
     49            return wp.ajax.send({
    5050                data: _.isObject( action ) ? action : _.extend( data || {}, { action: action })
    5151            });
     
    5353
    5454        /**
    55          * wp.xhr.send( [action], [options] )
     55         * wp.ajax.send( [action], [options] )
    5656         *
    5757         * Sends a POST request to WordPress.
     
    7171            options = _.defaults( options || {}, {
    7272                type:    'POST',
    73                 url:     wp.xhr.settings.url,
     73                url:     wp.ajax.settings.url,
    7474                context: this
    7575            });
Note: See TracChangeset for help on using the changeset viewer.