Skip to content

JS cleanup: deprecated jQuery patterns and var declarations #83

@apermo

Description

@apermo

Problem

js/plugin-report.js uses deprecated jQuery methods and outdated JS patterns:

  • jQuery.parseJSON() (line 58) — deprecated since jQuery 3.0, removed in jQuery 4.0. WordPress ships jQuery 3.x.
  • All variable declarations use var instead of const/let (lines 3–7, 12, 20, 50, 72, 73, 105, 119, 120)

Proposed changes

  • Replace jQuery.parseJSON(response) with JSON.parse(response)
  • Replace var with const or let as appropriate
  • Leave jQuery.post() as-is — jQuery is already loaded by WP admin, no benefit to switching to fetch()

No browser compatibility concern: const/let and JSON.parse() are ES6 (2015), supported by every browser WordPress still targets (IE11 was dropped in WP 5.8).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions