Editor: Use Beacon API over sync request
See https://www.w3.org/TR/beacon/ for more information. Built from https://develop.svn.wordpress.org/trunk@38425 git-svn-id: http://core.svn.wordpress.org/trunk@38366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dbdc1c28b1
commit
b67367b6f8
|
@ -407,16 +407,31 @@ jQuery(document).ready( function($) {
|
|||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
async: false,
|
||||
data: {
|
||||
action: 'wp-remove-post-lock',
|
||||
_wpnonce: $('#_wpnonce').val(),
|
||||
post_ID: $('#post_ID').val(),
|
||||
active_post_lock: $('#active_post_lock').val()
|
||||
var data = {
|
||||
action: 'wp-remove-post-lock',
|
||||
_wpnonce: $('#_wpnonce').val(),
|
||||
post_ID: $('#post_ID').val(),
|
||||
active_post_lock: $('#active_post_lock').val()
|
||||
};
|
||||
|
||||
if (window.FormData && window.navigator.sendBeacon) {
|
||||
var formData = new window.FormData();
|
||||
|
||||
$.each(data, function(key, value) {
|
||||
formData.append(key, value);
|
||||
});
|
||||
|
||||
if (window.navigator.sendBeacon(ajaxurl, formData)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to a synchronous POST request.
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon
|
||||
$.post({
|
||||
async: false,
|
||||
data: data,
|
||||
url: ajaxurl
|
||||
});
|
||||
});
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-alpha-38424';
|
||||
$wp_version = '4.7-alpha-38425';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue