Dear all this is my first post in Moodle,
May i know what is wrong with this following code
$(document).on('click', 'li', function(event) {
var courseid = [{ 'courseid': event.target.id }];
$.ajax({
method: "POST",
url: baseurl + "webservice/rest/server.php",
data: {
wstoken: token,
moodlewsrestformat: 'json',
wsfunction: 'core_course_get_contents',
params: courseid
}
})
.done(function(msg) {
$('#coursecontent').html(JSON.stringify(msg));
})
.fail(function(data) {
alert("error");
});
});
the ajax call is success, but it always return invalid parameter object as response , any clue