<ul><li>Fixed __TOKEN undefined bug in coupon.php: replaced with $globalclass->csrf_token() — __TOKEN constant is never defined in the coupons page include chain, causing every AJAX call to fail with 419 and the page to remain stuck on "Loading..."</li><li>Added AJAX error: handler — spinner now hides and shows error message on network/server failure instead of hanging indefinitely</li><li>Added explicit 419 detection in success handler — session expired error now shown clearly instead of masquerading as "No item available"</li><li>Replaced res.length > 0 with $.isArray(res) && res.length > 0 to safely handle non-array responses</li><li>Backed up coupon.php before modification</li></ul>