public function actionGetEntryTypes() { // Only ajax post requests $this->requirePostRequest(); $this->requireAjaxRequest(); // Get section $section = craft()->request->getPost('section'); $section = craft()->sections->getSectionById($section); // Get entry types $entrytypes = $section->getEntryTypes(); // Return JSON $this->returnJson($entrytypes); }