I have a couple of PHP modules that include JS and jQuery logic. One is chat.php and the other is fetch_user.php. chat.php does a jQuery ajax call to fetch-user.php and fetch_user.php returns an HTML table to chat.php which is then inserted into chat.php's DOM. All this works perfectly.
In the data returned from fetch_user.php there is an HTML button which has some attribute data which the ajax 'success' function has access to and I can extract this data OK.
My issue is that I have a JS array which as far as I am aware has global JS access. I want to first empty the existing data in that array (which is named logged_in_array) and the add the extracted attribute data to that array. In my code the logged_in_array.length = 0 does not empty the array, nor does the logged_in_array.push work.
So my specific issues are that the array is not being emptied nor is the attribute datum being added to the array.
I will attach extracts of the code: