Moodle.2x mod/reader small change to logic of JS code to create XMLHttpRequest