Page Redicrect when clicking full calender. where date as argument?
well, i am trying to work with fullcalender in a portal. where when user clicks on date it redirect to a new page which list the appointments from mysql database table. where date clicked by user should act as the parameter. well i'm integrating following calendar in Laravel MVC pattern. well its should be purely Jquery no Ajax or JSON should be used.
- $(function() { // document ready
- $('#calendar').fullCalendar({
- dayClick: function(date, allDay, jsEvent, view) {
- window.location.assign("http://localhost:8000/administrator/appointment/{{$date}}");
- // change the day's background color just for fun
- $(this).css('background-color', '#5C5550');
- }
- });
- });
laravel controller code,
- public function appointment($id,request $date)
- {
-
- if(Auth::user()->role=='Administrator' || Auth::user()->role=='Manager' )
- {
- $appoint = DB::table('offers')->where('date',$id)->get();
- foreach($appoint as $app)
- {
- $date = $app->date;
- }
- // $offers = DB::table('offers')->where('id', $id)->orderby('date','desc')->get();
- // $subcategories = DB::table('sub_categories')->get();
- // dd($offers);
-
- $brands=DB::table('offers')->get();
- //return $subcategory;
- // return response()->json(['offers' => $offers, 'categories' => $categories, 'brands'=>$brands]);
- return view('apointment', ['appoint' => $appoint,'date' => $date]);
- }
- else
- {
- return redirect('/administrator/appointment');
- }
- }
- }