In response to the XHR request to core_get_fragment the Moodle response has HTTP header Content-Type set to "text/html; charset=utf-8". But this function returns JSON so presumably the MIME type should be "application/json".
This causes an error in Moodle if there's some HTML processing between the web server and the browser, for example Apache's mod_proxy_html. Moodle sends JSON in reply to core_get_fragment:
But the HTML proxy sees the "text/html" MIME type and processes the output so it becomes:
Obviously this is no longer JSON so in the browser you get an error: JSON.parse: unexpected character at line 1 column 1 of the JSON data. This thread is an example of this issue.
(These steps shows the incorrect MIME type, not the HTML proxy issue resulting in the above error message).
- In Moodle go to the Participants page of a course.
- In your browser open the developer tools and switch to the network monitor.
- Click Enrol users.
- In the network monitor click on the request /lib/ajax/service.php?sesskey=...&info=core_get_fragment. Examine the response headers and check the Content-Type header.