PluginProbe
404 Solution / trunk
404 Solution vtrunk
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / js / settingsDeferred.js

settingsDeferred.js in 404 Solution trunk, at includes/js/settingsDeferred.js

45 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function ($) {
2 var $container = $('#abj404-gsc-deferred-content');
3 if ($container.length === 0) {
4 return;
5 }
6 if ($container.attr('data-deferred-load') !== '1') {
7 return;
8 }
9
10 var action = $container.attr('data-ajax-action') || 'abj404_load_gsc_section';
11 var nonce = $container.attr('data-ajax-nonce') || '';
12
13 $.ajax({
14 url: window.ajaxurl || 'admin-ajax.php',
15 type: 'POST',
16 dataType: 'json',
17 timeout: 15000,
18 data: {
19 action: action,
20 nonce: nonce
21 },
22 success: function (response) {
23 if (response && response.success && response.data && typeof response.data.html === 'string') {
24 $container.html(response.data.html);
25 $container.attr('data-deferred-load', '0');
26 return;
27 }
28
29 var message = 'Unable to load Google Search Console section.';
30 if (response && response.data && response.data.message) {
31 message = String(response.data.message);
32 }
33 $container.html('<p class="abj404-form-help">' + $('<div>').text(message).html() + '</p>');
34 $container.attr('data-deferred-load', '0');
35 },
36 error: function (jqXHR, textStatus) {
37 if (typeof console !== 'undefined' && console.log) {
38 console.log('404 Solution: GSC section load failed (' + textStatus + ')');
39 }
40 $container.html('<p class="abj404-form-help">Unable to load Google Search Console section.</p>');
41 $container.attr('data-deferred-load', '0');
42 }
43 });
44 });
45