I am new to development, apologies if question is basic
I am trying to add href page to the btn, but when the blade template parses url it's formatted and return error.
$('#municipal_option').on('change',function(e){
// console.log(e);
var municipal_id = e.target.value;
var BASEURL = "{!! url('admin/bank/') !!}";
console.log(municipal_id);
$.get( BASEURL + '/bankview?municipal_id=' + municipal_id, function(data){
console.log(data);
$("#bank_list tr").remove();
$.each(data,function(index, bankObj){
$('#bank_list').append('<tr class=""><td> ' + bankObj.bank_name + '</td> <td> ' + bankObj.bank_ac_no + ' </td> <td> '+ bankObj.bank_ifsc_code +' </td> <td> <button class="btn btn-primary"> **<a href="{!! asset('bank/{{$bank->id}}/edit')!!}"> Edit </a>** </td> <td> </td> </tr>');
});
});
});
The route:
| GET|HEAD | bank/{bank}/edit | bank.edit | App\Http\Controllers\bankController@edit
How to point to the above route.
The url that's generated, http://localhost/public/bank/%3C?php%20echo%20e($bank-%3Eid);%20?%3E/edit
Adding to the above question, Instead of looping the result(table) in the code, can I use it independently in the blade template with hep of @foreach.
Thank you.