Plugin Directory

Changeset 3276154


Ignore:
Timestamp:
04/17/2025 06:59:34 PM (12 months ago)
Author:
webstat
Message:

Version 2.5.7 bug correction

File:
1 edited

Legend:

Unmodified
Added
Removed
  • web-stat/trunk/js/wts_script.js

    r3275925 r3276154  
    9595        })
    9696        .then(function(response) {
    97             return response.json();
    98         })
    99         .then(function(response) {
    100             if (! response.success) {
    101                 send_debug_message('Error sending data to PHP', response.data);
    102             }
    103         })
    104         .catch(function(error) {
    105             send_debug_message('AJAX exception', error);
    106         });
     97            return response.text(); // Get raw response
     98        })
     99        .then(function(text) {
     100            try {
     101                const json = JSON.parse(text);
     102                if (!json.success) {
     103                    send_debug_message('Error sending data to PHP', json.data);
     104                }
     105            } catch (e) {
     106                send_debug_message('AJAX response is not valid JSON', text);
     107            }
     108        });
    107109}
    108110
Note: See TracChangeset for help on using the changeset viewer.