YII select2 not displaying items from a dropdown list

I am using select2 extension by kartik-v. I was able to make the department dependent on the faculty, but am having a problem making the courses dependent on the department. It shows on the courses list in the courses table in the database.

Here is my view file code:

<?php

&#036;data = ArrayHelper::map(Faculty::find()-&gt;all(), 'id', 'facultyname');





echo &#036;form-&gt;field(&#036;model, 'faculty_id')-&gt;widget(Select2::classname(), [


    'data' =&gt; &#036;data,


    'language' =&gt; 'en',


    'options' =&gt; ['prompt'=&gt;'select faculty',


        'placeholder' =&gt; 'Select Faculty.....',


        'onChange' =&gt; '&#036;.post(&quot;'.Url::to(['/department/lists']).'?id=' . '&quot;+&#036;(this).val(), function(data){


                        &#036;(&quot;select#student-department_id&quot;).html(data);


                        });'


    ],


    'pluginOptions' =&gt; [


        'allowClear' =&gt; true


    ],


]);


?&gt;

<?php

echo $form->field($model, ‘department_id’)->widget(Select2::classname(), [

    'language' =&gt; 'en',


    'options' =&gt; ['prompt'=&gt;'....Select Department....',


        'placeholder' =&gt; 'Select Department...',


        'onChange' =&gt; '&#036;.post(&quot;'.Url::to(['course/lists']).'?id=' . '&quot;+&#036;(this).val(), function(data){


                        &#036;(&quot;select#student-course_id&quot;).html(data);


                        });'


    ],


    'pluginOptions' =&gt; [


        'allowClear' =&gt; true


    ],


]);


?&gt;

<?php

&#036;courseList = ArrayHelper::map(Course::find()-&gt;orderby('coursename')-&gt;asArray()-&gt;all(), 'id', 


'coursename');





echo &#036;form-&gt;field(&#036;model, 'course_id')-&gt;widget(Select2::classname(), [      


  'data' =&gt; &#036;courseList,


    'language' =&gt; 'en',


    'size' =&gt; Select2::MEDIUM,


    'options' =&gt; ['prompt'=&gt;'....Select Courses....','placeholder' =&gt; 'Select Courses...','multiple' =&gt; true,'selected' =&gt; 'selected'],


    'pluginOptions' =&gt; ['allowClear' =&gt; true],


]);


?&gt;

My Course Controller code;

public function actionLists($id)

{

&#036;countCourses = Course::find()


        -&gt;where(['department_id' =&gt; &#036;id])


        -&gt;count();

$Courses = Courses::find()

        -&gt;where(['department_id' =&gt; &#036;id])


        -&gt;all();





if(&#036;countCourses&gt;0){


    foreach(&#036;Courses as &#036;Course){


        echo &quot;&lt;option value='&quot;.&#036;Course-&gt;id.&quot;'&gt;&quot;.&#036;Course-&gt;coursename.&quot;&lt;/option&gt;&quot;;


    }


}


else{


    echo &quot;&lt;option&gt;-&lt;/option&gt;&quot;;


}

}