【问题标题】:laravel 4.2 Get generated html table / html from View/bladelaravel 4.2 从 View/blade 获取生成的 html 表/html
【发布时间】:2016-04-14 15:30:02
【问题描述】:

我有以下生成的 jquery 表:

<table class="table table-striped table-condensed quotation_table">
        <thead>
          <tr>
             <th width="5">QTY</th>
             <th width="150">Description</th>
             <th width="150">Amount Per Candidate</th> 
          </tr>
        </thead>
        <tbody>
          <tr>
              <td>5</td>
              <td>some stuff</td>
              <td>$43</td>
         </tr>
    </tbody>
    </table>

我想从我的控制器中的表中获取&lt;td&gt; 获取数据的正常方法是使用Input::except('_token'),但是我无法使用这种方法获取表数据。

如何使用 laravel 4.2 获取表格数据。谢谢:)

【问题讨论】:

  • 我认为您必须使用 jQuery 从表中获取所需的数据,然后使用您拥有的数据对您 controller 中的特定 AJAX 进行调用聚集起来。
  • 我正在考虑使用 jquery 来制作 的隐藏输出,但这听起来很hackash @musicvicious
  • 你到底要完成什么?
  • 提交表格。我添加了一个答案,我仍然觉得它有点hackash,但它有效,让我知道你的想法@musicvicious
  • 这和我要建议你的差不多。

标签: php jquery html laravel-4 laravel-routing


【解决方案1】:

这感觉非常hackash,如果您有更好的解决方案,请发表评论。但使用此解决方案,您可以添加隐藏令牌、验证并将其放入 POST 表单中

 {{ Form::open(array('url'=>'/sendLearnerDetails', 'class'=>'form-horizontal form-group ', 'method' => 'post')) }

<div class="container">
  <table class="table table-striped table-condensed quotation_table">
    <thead>
      <tr>
        <th width="5">QTY</th>
        <th width="150">Description</th>
        <th width="150">Amount Per Candidate</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>
          <input name="qty" type="text" class="form-control" id="qty" value="5" readonly="readonly">
        </td>
        <td>
          <input name="description" type="text" class="form-control" id="description" value="some stuff" readonly="readonly">
        </td>
        <td>
          <input name="amountPerCanditate" type="text" class="form-control" id="amountPerCanditate" value="$43" readonly="readonly">
        </td>
      </tr>
    </tbody>
  </table>
</div>
{{ Form::submit('Approve table', array('class' => 'btn btn-primary')) }}
{{ Form::close() }}

Fiddle example.

【讨论】:

    猜你喜欢
    相关资源
    最近更新 更多
    热门标签