Aronaman
1 month ago
155
5
Laravel

tablular format

Posted 1 month ago by Aronaman

hello guys some issue in tablular format

<table id="org_table" class="display nowrap" style="width:100%">
  
                          <thead>

                           <tr>

                             <th>No</th>

                             <th>Org Name</th>
                           
                             <th>Type</th>.......
                        </tr>
                        </thead>
                        <tbody id="tBody"></tbody>
</table>

ajax blade code

 $('#addNew').click(function(){
                $.ajaxSetup({
                    headers: {
                      'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                                   }
                   });// ajaxsetup
var rowCount=$("#org_table tbody tr").length+1; 
// ?organization="+orgID+'&name='+form_data,
                   $.ajax({
                          type:"POST",
                         url:"{{route('localBook.store')}}?user_type="+userType,
                                dataType:'json',
                                data:form_data,
                                success:function(res){ 


           var trHTML = '';
               $.each(res, function (i, item) {
                  trHTML += 
                   '<tr>'+
                      '<td id="row_'+rowCount+'" >' +rowCount+ '</td>'+
                       '<td>' + res.item.bookable.slug + '</td>'+
                       '<td>' + res.item.bookable_type + '</td>'+
                       '<td>' + res.item.bookable.slug + '</td>'+
                      '<td>' + res.item.no_date + '</td>'+
                      '<td>' + res.item.quantity + '</td>'+
                       '<td>' + res.item.bookable.room_price + '</td>'+
                       '<td>' + res.item.sub_total + '</td>'+
                       '<td>' + res.item.discount_amount + '</td>'+
                       '<td>' + res.item.discount_price_on_web + '</td>'+
                      '<th id="delete_'+rowCount+'" scope="row" class="delete_row" >'+remove+'</th>'+
                   '</tr>';
                       });
                $('#org_table tbody').append(trHTML);
                    }// function success 
                 });

        });// #add new

response on console crome

{"id":13,"bookable_type":"App\Room","bookable_id":2,"local_reservation_id":20,"booked_by":"37","name":null,"email":null,"user_id":null,"no_date":2,"quantity":1,"check_in":"2020-02-27 00:00:00",.....
}

my table is not showing up this is b/c post request???? or did i make mistake, thanks in adavance

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