I created two custom functions in javascript.
var myDataKey;
app.on('jsonRepeaterLineClick', function (repeater, rowindex, key, data, target) {
var x = Array.from(document.querySelectorAll('.item-json')).forEach(function(datakey){
var myDataKey = key;
console.log("key: " + key);
console.log("myDataKey: " + myDataKey);
});
});
$(document).on('page:init','.page[data-name="coupos_pro_cat"]', function (e, page) {
var page = e.detail;
console.log("key2: " + myDataKey);
});
myDataKey is set in first page and i want take it to another page.
I need var myDataKey in the second function. But if iam calling that, iam only getting:
variable [myDataKey] is undefined
Whats wrong?