Having trouble incrementing the current page in my pagination script to call the next page via AJAX...
In my TypeScript file, I declare a global variable like this;
declare var getCurrentPage: number;
Later in the same file, I set the value for getCurrentPage from my initial AJAX call
globalThis.getCurrentPage = data && data.startPage;
currentPage: getCurrentPage || 0,
This setup allows for flexibility as currentPage could have different values or default to zero if getCurrentPage is not available.
In my pagination file separate from the above (to account for initial AJAX-derived values), I attempt to increment my values and update the global variable accordingly
const nextPage = this.currentPage + 1;
globalThis.getCurrentPage = nextPage;
However, this leads to nextPage being 1 and currentPage remaining at 0. When pressing the Next Page button, the values stay the same because 0 + 1 equals 1...
What could be causing this issue?