Javascript And Ajax SyntaxError at Enrolment Moodle 3.8

Javascript And Ajax SyntaxError at Enrolment Moodle 3.8

Leo Peçanha -
Number of replies: 3

Hello everybody!

I was last week trying to resolve an error after upgrading Moodle to version 3.8.2+ stable.

The error occurs on the list of users enrolled in the course when I click the Register User button. Displays a blank alert popup with the title "SyntaxError".

When I activate the error display for developers and display some more details of the problem:

SyntaxError: Unexpected token < in JSON at position 0
    at parse (<anonymous>)
    at https://sub.domain.com.br/lib/javascript.php/1587762995/lib/jquery/jquery-3.4.1.min.js:2:78358
    at l (https://sub.domain.com.br/lib/javascript.php/1587762995/lib/jquery/jquery-3.4.1.min.js:2:78475)
    at XMLHttpRequest.<anonymous> (https://sub.domain.com.br/lib/javascript.php/1587762995/lib/jquery/jquery-3.4.1.min.js:2:81117)

I also looked at the browser inspector:

Query.Deferred exception: Unexpected token < in JSON at position 0 SyntaxError: Unexpected token < in JSON at position 0

    at parse (<anonymous>)

    at https://sub.domain.com.br/lib/javascript.php/1587762995/lib/jquery/jquery-3.4.1.min.js:2:78358

    at l (https://sub.domain.com.br/lib/javascript.php/1587762995/lib/jquery/jquery-3.4.1.min.js:2:78475)

    at XMLHttpRequest.<anonymous> (https://sub.domain.com.br/lib/javascript.php/1587762995/lib/jquery/jquery-3.4.1.min.js:2:81117) undefined

k.Deferred.exceptionHook @ jquery-3.4.1.min.js:2

I thought there was an error in the upgrade, because I made it from 3.3 (PHP 7.1, MySQL 5.7 MariaBD, SSL Active) to 3.8.2. Then I upgraded again, version by version, 3.4, 3.5, etc., up to 3.8.2. And I repeated the test on the subscribers list screen in each version I updated. Only in version 3.8.2 the problem happens.

The only solution suggestion I found here on the forum was this:

https://moodle.org/mod/forum/discuss.php?d=394922

He suggests disabling the Javascript cache. However, as the author said, it creates other problems, as we need the Javascript cache active for a good functioning.

I would like to know if anyone else has this problem, if they managed to solve another problem and if there is a correction forecast for this.

The definitive solution for me so far was not to use the upgrade to 3.8.2, keeping the 3.7 stable active where the problem does not occur.

Translated with Google translate from Brazilian Portuguese.

Վարկանիշների միջին թիվը. -
In reply to Leo Peçanha

Re: Javascript And Ajax SyntaxError at Enrolment Moodle 3.8

Emma Richardson -
Documentation writers Նկարը Particularly helpful Moodlers Նկարը Plugin developers Նկարը
Have you tried just clearing all your caches to see if that resolves it?
In reply to Emma Richardson

Re: Javascript And Ajax SyntaxError at Enrolment Moodle 3.8

Leo Peçanha -

Hi Emma!
Yes! I cleared the cache through the site administration, also from the themes and via FTP.
But it did not resolve the error