亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將數據從數據表添加到 Laravel 中的模式

將數據從數據表添加到 Laravel 中的模式

PHP
尚方寶劍之說 2023-10-01 16:10:22
我有以下代碼,我想知道如何將數據從表傳遞到模態這是我在 edit.blade.php 中的代碼。模式確實有效,但我不知道如何使數據顯示在模式中,我會自己 POST 到數據庫,但我只想知道如何顯示該數據,以便我可以編輯它。我想在模態中顯示的數據是 ID、姓名和電子郵件。這是我在 editar.blade.php 中的代碼<script src="{{ url('/js/vendor/jquery-1.12.4.min.js') }} "></script><script src="{{ url('/js/bootstrap.min.js') }} "></script><link rel="stylesheet" href="{{ url('/css/bootstrap.min.css') }} "><script src="{{ url('/js/jquery.dataTables.min.js') }} "></script><div class="container">  <h2>Editar estudiante</h2><div class="container">               <h2>Laravel DataTables Tutorial Example</h2>               <table id="user_table" class="table table-bordered table-striped">     <thead>      <tr>                <th width="35%" id="name">Name</th>                <th width="35%" id="email">Email</th>                <th width="30%">Action</th>      </tr>     </thead>    </table></div><div class="modal fade" id="edit-modal" tabindex="-1" role="dialog" aria-labelledby="edit-modal-label" aria-hidden="true">  <div class="modal-dialog modal-lg" role="document">    <div class="modal-content">      <div class="modal-header">        <h5 class="modal-title" id="edit-modal-label">Edit Data</h5>        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>        </button>      </div>      <div class="modal-body" id="attachment-body-content">        <form id="edit-form" class="form-horizontal" method="POST">          <div class="card text-white bg-dark mb-0">            <div class="card-header">              <h2 class="m-0">Edit</h2>            </div>
查看完整描述

1 回答

?
吃雞游戲

TA貢獻1829條經驗 獲得超7個贊

你能試試這個嗎?

   $('#modal-input-name').val($tr.find('td.user-name').text());

   $('#modal-input-email').val($tr.find('td.user-email').text());

另外,我建議您使用 acss class來定位點擊事件,就像Id通常用于唯一標識符一樣,并且按照您的方式,您將擁有許多具有相同內容的表行Id,這違背了最初的想法。


查看完整回答
反對 回復 2023-10-01
  • 1 回答
  • 0 關注
  • 100 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號