course_module_options( $courseid ); foreach($config->field_sets as $fs => $flds) { foreach($flds as $n => $option_obj) { $fields[$n] = $option_obj->translatedOptions(); } } $content = array( 'result' => 'refreshed', 'fields' => $fields ); print json_encode($content); exit; function error_output($error) { $content = array( 'result' => 'failed', 'error' => $error, ); print json_encode($content); exit; } ?>