weixin_33743703 2018-03-24 13:45 采纳率: 0%
浏览 10

Ajax在表内不起作用

I want to create an ajax inside table, but when I try to increment the id="specificationName[' . $t . '], it does'nt work. If I don't use [' . $t . '], it work but if I have 3 row it insert the 3 input only in the first row and not in each row.

Thank you

<script  src="http://boutique/javascript/tokeninput/jquery.tokeninput.min.js"></script>

  $products_specification_ajax = OSCOM::link('products_specification_ajax.php');
  $t = 0;
      while ($Qspecification->fetch()) {

       $QspecificationName = $this->app->db->prepare('select specification_id,
                                                             language_id,
                                                             name
                                                       from :table_specification_description
                                                       where  language_id = :language_id
                                                       and specification_id = :specification_id
                                                    ');
        $QspecificationName->bindInt(':language_id', $this->lang->getId());
        $QspecificationName->bindInt(':specification_id', $Qspecification->valueInt('specification_id'));
        $QspecificationName->execute();

  $content .= '<td>
<script type="text/javascript">
  $(document).ready(function() {
    $("#specificationName[' . $t . ']").tokenInput("' . $products_specification_ajax . '" ,
        {
          tokenLimit: 1,
          resultsLimit: 5,
          onResult: function (results) {
            $.each(results, function (index, value) {
              value.name = value.id + " " + value.name;
            });
            return results;
          }
        });
  });
</script>

' . HTML::inputField('specification_name[' . $t . ']', $specification_name, 'class="token-input" id="specificationName[' . $t . ']"') . '</td>';

$t++;
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 有赏,i卡绘世画不出
    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入
    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题
    • ¥15 FPGA-SRIO初始化失败
    • ¥15 MapReduce实现倒排索引失败
    • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
    • ¥15 找一位技术过硬的游戏pj程序员
    • ¥15 matlab生成电测深三层曲线模型代码