show details when user clicked selected button

  ajax, javascript, laravel

i want to show the bill number when user click it from list,

i have already fetch the data as well but i dont know how can i add this url /api/sales_bill_info/{$bill_number} to show that bill number details.

    $.each(resultData,function(index,row){

                        // var editUrl = url+'/'+row.id+"/edit";
                        bodyData+="<tr style='font-size: 0.78em;'>"
                        bodyData+="<td>"+ i++ +"</td>"+
                        "<td><a href="{{url('/api/sales_bill_info/'.+row.bill_number+)}}" class='btn btn-success btn-sm printbill' value='"+row.bill_number+"' style='margin-left:20px;'>PRINT</a></td>"+
                         "<td><button class='btn btn-sm btn-danger cancelbill' id='cancelbill' value='"+row.SID+"' style='margin-left:20px;'>CANCEL BILL"+row.SID+"</button></td>"+
                        "<td>"+row.bill_number+"</td>"+
                        "<td>"+row.compy_name+"</td>"+
                        "<td>"+row.truck_number+"/"+row.trailer_number+"</td>"+
                        "<td>"+row.Devicenumber+"</td>"+
                        "<td>"+row.slavename+"</td>"+
                        "<td>"+row.name+"</td>"+
                        "<td>"+row.tag_area+"</td>"+
                        "<td>"+row.Lname+"</td>"+
                        "<td>"+row.bill_number+"</td>"+
                        "<td>"+row.driverPhone+"</td>"+
                        "<td>"+row.created_at_sale+"</td>"+
                         "<td><button class='btn btn-danger delete' value='"+row.id+"' style='margin-left:20px;'>Delete</button></td>";
                        bodyData+="</tr>";
                        
                    })
                    $("#bodyData").append(bodyData);
                }
            });

i tried to add this "<td><a href="{{url('/api/sales_bill_info/'.+row.bill_number+)}}" class='btn btn-success btn-sm printbill' value='"+row.bill_number+"' style='margin-left:20px;'>PRINT</a></td>"

but does not works.

someone can help me on this

Source: Laravel

Leave a Reply