drt5813 2019-02-13 05:36
浏览 89

试图在admin lte 3日历中获取数据,但我在laravel中显示它们时遇到问题

In my calendar I want to show appoinmtents for the specific date. When a user clicks on date a form would slide down and it would have details but I tried with ajax and jquery to do this. I get the data and with ajax and I tried to console log it and I did get data there but its showing same data on all dates and I haven't found any solution for this.

<div id="calendar" style="width: 100%" 
    @foreach($ress as $res)data-id="{{ $res->id }}" data-content="{{ $res->name }}" @endforeach 
    onclick="getDetails(this)">
</div> 

this is where my calendar shows up

function getDetails(myObj) {

    $(document).ready(function () {

        $('.day').click(function () {

            var id = $(myObj).data('id');
            $.ajax({
                url: '{{ route('get.details') }}',
                type: "GET",
                data: {
                    res_id: id,
                    '_token': $('input[name=_token]').val()
                },
                success: function (res) {
                    var response = $(res);
                    console.log(response);

                },
                error: function (err) {
                    console.log(err);
                }
            });
        });
    });
}

this is my ajax function to get appointments

  public function getDetails(Request $request)
  {

    $response = Reservation::findOrFail($request->res_id);

    return response()->json(['success'=>'yes it works','response'=>$response]);
  }

This is my method in controller

What I want to happen is when I click on a date it should only bring it's appointments set by the admin and I have failed miserably in trying to do that I will be really thankful if anyone can guide me here.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line