i'm new to moodle and i would like to write an moodle mod. So i need to load some data and send it back to the client. On the client side there is js Code so i do this with an ajax request. For this loading i need the course Id. The Problem is that i don't get the right id. The code snipped:
<?phpThe $COURSE Variable contains the information about moodle and not about the course the mod is located.
$action = $_POST['action'];
case 'loadSomething': loadSomething($_POST['uid']); break;
$courseId = $COURSE->id;//wrong
Can someone help me?