PluginProbe
WebberZone Top 10 — Popular Posts / 4.4.3
WebberZone Top 10 — Popular Posts v4.4.3
4.5.1 4.5.0 4.4.3 4.4.2 4.4.1 4.4.0 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 trunk 1.0 1.0.1 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.5.3 1.6 1.6.1 All 117 releases
top-10 / includes / js / top-10.js

top-10.js in WebberZone Top 10 — Popular Posts 4.4.3, at includes/js/top-10.js

32 lines 998 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 document.addEventListener('DOMContentLoaded', function () {
2 var params = {
3 action: 'tptn_tracker',
4 top_ten_id: ajax_tptn_tracker.top_ten_id,
5 top_ten_blog_id: ajax_tptn_tracker.top_ten_blog_id,
6 activate_counter: ajax_tptn_tracker.activate_counter,
7 top_ten_debug: ajax_tptn_tracker.top_ten_debug
8 };
9
10 fetch(ajax_tptn_tracker.ajax_url, {
11 method: 'POST',
12 headers: {
13 'Content-Type': 'application/x-www-form-urlencoded',
14 'Cache-Control': 'no-cache'
15 },
16 body: new URLSearchParams(params).toString()
17 })
18 .then(function (response) {
19 if (!response.ok && 204 !== response.status) {
20 throw new Error('Tracker request failed');
21 }
22
23 return response.text();
24 })
25 .then(function (data) {
26 // handle the response data
27 })
28 .catch(function (error) {
29 console.error('Error:', error);
30 });
31 });
32