请任何人知道我如何使用此按钮将值动态传递给模型...意思是..我有动态值要传递给此模型...我该怎么做...
//this is the button
<p> <button type="button" data-target="#exampleFormModal" data-toggle="modal"> Load</button> </p>
//from here is the model
<div id="exampleFormModal" aria-hidden="false" aria-labelledby="exampleFormModalLabel"
role="dialog" tabindex="-1">
<div class="modal-dialog">
</div>
</div>
最佳答案
我知道了......以防任何可能需要它的人..
我只是将变量(在本例中为 laravel 变量)传递到模型 ID 中,如下所示 id="exampleFormModal{{ $item->id}}"
//BUTTON..check the id
<p> <button type="button" class=" btn-block btn btn-direction btn-bottom btn-success btn-outline" data-target="#exampleFormModal{{ $item->id}}" data-toggle="modal"> Load Truck</button> </p>
//Model ..check the ID
<div class="modal fade" id="exampleFormModal{{ $item->id}}" aria-hidden="false" aria-labelledby="exampleFormModalLabel"
role="dialog" tabindex="-1">
关于javascript - 如何将动态值从 html 按钮传递到模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59651129/