I have tried to follow the AJAX documentation for moodle and this guide in particular. I set up the $functions array in services.php as closely to as shown here as possible, and tried to create my external functions API calls two ways: Inside myPlugin/externallib.php and inside myPlugin/classes/external.php (I believe the latter is the correct file to do it?) and updated the file path in services.php to match.
Finally, my ajax call itself is done within my module.js file which uses core/ajax.
I get no errors, but my ajax request always returns the fail case output. Also, I have web services enabled on the moodle instance.
As a last resort I also tried to just make an ajax call using jquery, but get an internal server error (500). I’m guessing that this is because I’m not allowing the ajax function through as an external function, but not too sure. Of course I would ideally want to do things using the core/ajax library through Moodle, but haven’t had luck either way so far.
All insight and advice is much appreciated!