WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9587 closed defect (bug) (duplicate)

wp-ajax-response not loaded !

Reported by: arena Owned by:
Milestone: 2.8 Priority: highest omg bbq
Severity: critical Version:
Component: Administration Keywords:
Focuses: Cc:

Description

Well, i do not know if it is a wp bug but i am asking for an expert eye !

One of the main changes in 2.8 admin is that javascript can be inserted in the footer.

In order to comply with the current wp admin screen, i intended to do so for my plugin (MailPress)

I have been comparing the 'new post' html source with the 'new mail' html source and for the javascript the result looks very similar,
except that in my plugin, i am loading a specific "handle"
for wp-ajax-response called mp-ajax-response :

$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
wp_register_script( 'mp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1);
wp_localize_script( 'mp-ajax-response', 'wpAjax', array( 'noPerm' => __('Email was not sent AND/OR Update database failed','MailPress'), 
                                                         'broken' => __('An unidentified error has occurred.'), 
                                                         'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};' ) );

I get the following in the html source :

<script type='text/javascript' src='http://127.0.0.1/wp28/wp-admin/load-scripts.php?c=0&amp;load=hoverIntent,common,jquery-color,schedule,mp-ajax-response,jquery-ui-core,jquery-ui-sortable,postbox,thickbox&amp;ver=3a76a22d74c994ad03412a0aa610805d'></script>

So mp-ajax-response is appearing in the list of handles loaded except that when i look at the js file generated,

i can see schedule js code,
No wp-ajax-response js code !
jquery-ui-core js code

The result is things like :

wpAjax.parseAjaxResponse is not a function

The 2.8 adapted plugin can be downloaded here :

http://andrerenaut.ovh.org/wp/wp-content/UserFiles/download.php?path=plugins/&fname=mailpress.for.2.8.zip

The js register and enqueue are located in mailpress/mp-includes/class/MP_Admin.class.php

The test is once the plugin is activated,

to go to 'New Mail' option.
after 1 min autosave activates and the results ends with the javascript error.



Thank you for your help !

Change History (3)

comment:1 follow-up: arena5 years ago

  • Priority changed from normal to highest omg bbq
  • Severity changed from normal to critical

wp-admin/load-scripts.php ONLY ACCEPTING handles defined in 'script-loader.php')

and not accepting handles defined by plugins !

comment:2 in reply to: ↑ 1 arena5 years ago

Replying to arena:

When js url is like wp-includes/js

comment:3 arena5 years ago

  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.