title: Laravel Ajax request returning whole page rather than just data
body: <p>I'm trying to use ajax to find the next page on my pagination. However it keeps bringing in the whole body. I've taken a print screen to show the problem.</p>
  
  <p>I'm not an expert on ajax show would appreciate some help as to how I can rectify this issue?</p>
  
  <p>My code is below:</p>
  
  <pre><code>public function viewall()
  {
      $data["projects"] = $projects = Auth::user()-&gt;projects()-&gt;paginate(3);
  
      if(Request::ajax())
              {
  
              $html = View::make('projects.viewall', $data)-&gt;render();
              return Response::json(array('html' =&gt; $html));
          }
  
          return View::make('projects.viewall')-&gt;with('projects', $projects);
  }
  </code></pre>
  
  <p>Js/js.js</p>
  
  <pre><code>$(".pagination a").click(function()
  {
      var myurl = $(this).attr('href');
  
      $.ajax(
      {
          url: myurl,
          type: "get",
          datatype: "html",
          beforeSend: function()
          {
              $('#ajax-loading').show();
          }
      })
      .done(function(data)
      {
          $('#ajax-loading').hide();
          $("#projects").empty().html(data.html);
      })
      .fail(function(jqXHR, ajaxOptions, thrownError)
      {
            alert('No response from server');
      });
      return false;
  });
  </code></pre>
  
  <p>viewall.blade.php</p>
  
  <pre><code>@extends("layout")
  @section("content")
  
  &lt;div class="container"&gt; 
  &lt;h4&gt;Your Projects&lt;/h4&gt;
  
  &lt;div id="ajax-loading" class="alert alert-warning" style="display: none;"&gt;
  &lt;strong&gt;Loading...&lt;/strong&gt;
  &lt;/div&gt;
  
  @if (Auth::check())
      @if (count($projects) &gt; 0)
     @foreach ($projects as $project)
  
     &lt;div class="one-third column" id="projects"&gt;
  
    {{ $project-&gt;project_name }}
      {{ $project-&gt;project_brief }}
     {{ date("d-m-Y", strtotime($project-&gt;start_day)) }}
  
     &lt;/div&gt;
  
     @endforeach 
     @else
      &lt;h5 class="errorslist"&gt;You have no projects click &lt;a class="errorslist" href="/project/create"&gt;here to create a project&lt;/a&gt;&lt;/h5&gt;
  @endif
    @endif
  
    &lt;div class="sixteen columns"&gt;
      {{ $projects-&gt;links() }}
      &lt;/div&gt;
  &lt;/div&gt;
  @stop
  </code></pre>