mercredi 28 février 2018

Pass a View Data From Controller to Ajax View File - Laravel 5

From View Page I am calling Ajax to my Controller, from my Controller I want to create a html data so I am passing my array to View file to create a HTML data. I don't know why when I try to do console nothing gets return, can anyone tell me where I am going wrong

CallingAjaxFromViewFile

function AjaxgetCheckInChekOutUser(status){
    var url = "";
    var token = $('#token').val();
    if(status){
        $.ajax({
                headers: {
                'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
                },
                url: url,
                type: 'POST',
                data: {'status': status,'_token':token},            
                success: function (data) {
                    alert(data);
                    data = JSON.parse(data);      
                        console.log(data.html);
                        $('#gymimages').html(data.html);

                }
        });
    }
}

myControllerFile

public function AjaxCurrentPastFutureData($data, $status){
 $title = "HDTuto.com";  

        $html = view('admin.events.ajaxdataview')->with(compact('title'))->render();
        //pr($html);
        $response = response()->json(['success' => true, 'html' => $html]);
        return $response;
}

NowmyViewFile From Where I append HTML Data

<h1><i> </i></h1>

Can anyone tell me where I am going wrong?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oD0dvi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire