now i am able to view the data in the console but its not redirecting to that page. do i need to change. @tomo_pongrac and @Khudadad


@massum You returned the data to roombooking page and know you can display it.

return view ('partials.roombooking', compact('data'))->render() ;
{{ $data }}

Note: If you returned data as json simply get your element id and set it to the data returned.

      url: '/roombooking',
      type: "get",
      data: {id:data},
       success: function(response){ 
      if(data == "success")
     // alert(response); 
error: function(response){

but here is the thing, i have written the ajax in the view name 'booking' and i want to display the fetched data from ajax in roombooking. currently the data is getting return to the booking view. not in roombooking view. @Khudadad


You can write javaScript in external file and than you include that file in footer.

like this

<script type="text/javascript" src="/js/jquery.min.js"></script>

what i mean is i want to take the value of one page and send it to another page. As i m new to laravel so i don't know how to go about it. So far i am able to get the data of the view to the controller. but from the controller how to return to another view is what i am not clear about. @Khudadad and @tomo_pongrac


when i run the code as u sugested i get the link in the console "XHR finished loading: GET "http://localhost:8000/roombooking?id=2". but its not redirecting to that page. Kindly suggest me on how to achieve that i m really stuck in here and can't proceed further @Khudadad



how I show my MODAL in ajax ? AJAXCONTROLLER:

public function returnProfile(Request $request) {
        $id = $request->id;
        $profile = Profile::find($id);
        $data = view('', compact('profile'))->render();
        return response()->json( $data );


    function Profile(id) {
        //url       : "/dashboard/perfil/"+id,
        url       : "/dashboard/perfil/",
        method    : 'GET',
        data      : { 'id' : id },
        //success   : 'success',
        //dataType  : 'JSON',
        success   : function(data){
            $('#viewProfile').modal('show');     <<<<<<<<<<<<<<<<<<?????
            console.log('erro no modal');


<div class="modal fade" id="viewProfile" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="smallModalLabel">Visualização</h4>
            <div class="modal-body">
                <strong>Perfil:</strong> {{ $profile->name }}
                  <strong>Descrição:</strong> {{ $profile->label }}
            <div class="modal-footer">
                <button type="button" class="btn btn-success btn-link waves-effect">DELETAR</button>
                <button type="button" class="btn btn-danger btn-link waves-effect" data-dismiss="modal">CLOSE</button>

Please sign in or create an account to participate in this conversation.