title: Rendering AJAX view in Cakephp
body: <p>I have a method which will render a standard view file <code>index.ctp</code> or an AJAX view file <code>index_ajax.ctp</code> depending on the request type</p>
  
  <p>Within my controller - I have the following code</p>
  
  <pre><code>public function index() {
     if ($this-&gt;request-&gt;is(array('get', 'post))) {
       // .... do normal stuff
     } elseif ($this-&gt;request-&gt;is('ajax')) {
       $this-&gt;autorender = false;
       echo 'blah blah'; // this shows 
       $this-&gt;render('index_ajax', 'ajax'); // this does not render
       exit;
     }
  }
  </code></pre>
  
  <p>The Javascript that invokes this AJAX view is as below</p>
  
  <pre><code>$('#myModal').on('show.bs.modal', function (event) {
      $.ajax({
          url: '/cake/myController/index',
          type: 'ajax',
          success: function(data) {
              alert(data);
              $('#link-list').html(data);
          }
      });             
  });
  </code></pre>
  
  <p>Now the normal index view renders just fine - no problems at all, however the AJAX view is not rendering. If I put an echo statement in the controller, that statement does get outputted to the view but the actual view file itself is not getting picked up and rendered. I am not sure what my mistake is - any help is appreciated.</p>