Issues with Page Init

Hi, I have issues with page init event.
I have a page “TaskDetails” that run an ajax call when user open that page

$(document).on(‘page:init’, function (e, page) {
var task_id = page.route.query.task_id;

When open Taskdetail run one time. If user go back and the open TaskDetail again run 2 times, and so on, every time open TaskDetail add a new page init event and run as times as he opens taskdetail. How can I destroy page init to avoid run many times.


Solved, change:

$(document).on(‘page:init’, function (e, page) {


$on(‘pageInit’, (e, page) => {

1 Like