title: Failed to load resource: the server responded with a status of 500 (Internal Server Error) - Using datatables with ajax and codeigniter
body: <p>I am using datatables with ajax and jquery to get the message details from my database. when i load the file the error showing like "Failed to load resource: the server responded with a status of 500 (Internal Server Error)". Thanks in Advance.</p>
  
  <p>This is My view area</p>
  
  <pre><code>&lt;div class="row"&gt;
              &lt;div class="col-md-4"&gt;&lt;/div&gt; 
              &lt;div class="col-md-4"&gt;
               &lt;div class="panel panel-default"&gt;
                 &lt;div class="panel-heading"&gt;
                    &lt;h3 class="panel-title"&gt;Admin&lt;/h3&gt;
                 &lt;/div&gt;
                 &lt;div class="panel-body"&gt;
                 &lt;form action="" method="post" id="frm_login"&gt;
                 &lt;div class="form-group"&gt;
                    &lt;label for="adminname"&gt;Admin Name&lt;/label&gt;
                    &lt;input type="text" class="form-control" name="adminname" id="adminname" placeholder="Admin Name" required="required"&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                    &lt;label for="adminpassword"&gt;Password&lt;/label&gt;
                    &lt;input type="password" class="form-control" name="adminpassword" id="adminpassword" placeholder="Password" required="required"&gt;
                   &lt;/div&gt;
                 &lt;button type="submit" class="btn btn-primary" id="submit"&gt;Submit&lt;/button&gt;
                &lt;/form&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt; 
              &lt;div class="col-md-4 "&gt;&lt;/div&gt; 
          &lt;/div&gt;
      &lt;/div&gt;      
  </code></pre>
  
  <p>This is my Ajax and datatable area</p>
  
  <pre><code>&lt;script src="&lt;?php echo base_url("assets/js/jquery-1.12.4.min.js");?&gt;"&gt;&lt;/script&gt;
              &lt;script src="&lt;?php echo base_url("assets/js/bootstrap.min.js");?&gt;"&gt;&lt;/script&gt;
              &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
              &lt;script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"&gt;&lt;/script&gt;
              &lt;script&gt;
                  var table;
                  table=$('#messages').DataTable({
                     "ajax":{
                       "url":"&lt;?php echo base_url("Admin_Creator/viewmessage") ?&gt;",
                       "type":"post"
                     }
                  });
  
               });
             &lt;/script&gt; 
  </code></pre>
  
  <p>This is my Controller area</p>
  
  <pre><code>        public function viewmessage(){  
                $show=$this-&gt;Model_Creator-&gt;Select_Message();
                $data=array();
                foreach($show as $rows){
                    array_push($data,
                            array(
                            $rows['message']
                            )
                );
             }
             $this-&gt;output-&gt;set_content_type('application/json')-&gt;set_output(json_encode(array('data'=&gt;$data)));    
          }
  </code></pre>
  
  <p>This is my model area </p>
  
  <pre><code>       public function Select_Message(){  
               $this-&gt;db-&gt;select('*');
               $this-&gt;db-&gt;select('messages');
               $query=$this-&gt;db-&gt;get();
               return $query-&gt;result_array();
             }
  </code></pre>