I have build a laravel application.Where I want to search the data using date range. Here i'm using controller and after calling the controller,data get retrieved and redirecting to same page. Here there is situation like page load. But I don't want to load the whole page.instead of it, if I want to use ajax to call the controller only that particular controller will be called and there is no redirection. How do I do it using Ajax?

Here is my controller:

```
public function reportByDate(Request $request)
{
     $revenue = DB::table('fees')
        ->join('courses', 'courses.id', '=', 'fees.course_id')
        ->join('users', 'courses.id', '=', 'users.course_id')            
        ->where('users.completed_status', '=', 1)
        ->sum('fee');

        $startDate = $request->Input(['sdate']);
        $finshDate=$request->Input(['edate']);

     $input = DB::table('fees')->join('courses', 'fees.course_id', '=','courses.id')
        ->join('users', 'users.course_id', '=', 'courses.id')
        ->where('users.completed_status', 1)
        ->whereBetween('users.date', [$startDate, $finshDate])
        ->groupBy('fees.course_id')
        ->selectRaw('SUM(fee) as fee, courses.name')
        ->get();

     return view('revenueDetails',['revenue'=>$revenue],['input'=>$input]);
}

```

Here is the view page:

```
@extends('layouts.master')
@section('title')
Revenue Details
@endsection
@section('content')

<div class="container">
<h3> Revenue Details </h3>
</br>
</br>

  {!! Form::open(array('route' => 'reportByDate','class'=>'form-horizontal','method'=>'POST'))  !!}
  {!! Form::token(); !!}
  {!!   csrf_field() ; !!} 
          <div class="form-group">
              <label> Start Date</label>  
              <input type="date" name="sdate" class="form-control" >
          </div>
          <div class="form-group">
              <label> End Date</label>  
              <input type="date" name="edate" class="form-control" >
          </div>

          <button type="submit" class="btn btn-default">Submit</button>
    {!! Form::close() !!}

<h4>Total Revenue: {{$revenue}}</h4></br>
</br>

      <table  class="table table-striped table-bordered"  id="example">
        <thead>
          <tr>
            <td>Serial No</td>
            <td>Course Name</td>            
            <td>Course Revenue</td>                      
          </tr>
        </thead>
        <tbody>
      {{--    {{dd($input)}} --}}
          <?php $i=1; ?>
         @foreach($input as $row)

          <tr>
            <td>{{$i}}</td>
            <td>{{$row->name}}</td>
            <td>{{$row->fee}}</td>

          </tr>
            <?php $i++; ?>     
        @endforeach

        </tbody>

      </table>
        <li><a href="{{ route('userDetails') }}">See the User Details</a></li>
    </div>
@endsection

```