Looks like you have tried a lot of good debugging arleady, and not yet found any useful clues.
In the Browser developer tools, can you switch to the 'Network' tab, and try it again. Can you see the request to Moodle that leads to the 'Undefined' message? Does looking at the information about that request show anything useful?
In the Browser developer tools, can you switch to the 'Network' tab, and try it again. Can you see the request to Moodle that leads to the 'Undefined' message? Does looking at the information about that request show anything useful?