如何使用jquery从数据库检索数据,并且相同的数据应加载到引导表中

问题描述

{

      <div class="container">
            <table id ="table" data-toggle="table" class="tabletable-striped table-hover display" style="width:100%">
                <thead>
                    <tr>
                        <th
                            data-field="EMPLOYEECODE"><b>EMPLOYEECODE</b></th>
                        <th
                            data-field="INDENTDATE"><b>INDENTDATE</b></th>
                        <th
                            data-field="INDENTNO"><b>INDENTNO</b></th>

                        <th
                            data-field="INDENTSHORTDES"><b>INDENTSHORTDES</b></th>
                        <th
                            data-field="REGISTEREDDATE"><b>REGISTEREDDATE</b></th>
                        <th
                            data-field="LINEITEMCODE"><b>LINEITEMCODE</b></th>

                    </tr>
                </thead>
            </table>
        </div>

  }

HTML代码 {

                     <form class="form-inline">
                        <div id="myapp" ng-app="myApp"
                             ng-controller="formCtrl">
                            <input class="form-control mr-sm-2"
                                   id="search" type="text" placeholder="Search" ng-model="search"> 
                                <button
                                   type="VIEW INDENTS" id="indents" class="btn btn-pink"><b>VIEW 
INDENTS</b></button>
                        </div>

                    </form>

}

jQuery代码

{

    $(document).ready(function () {
            $.ajax({
                url: 'coinsIndentsServlet',type: 'GET',dataType: 'json',timeout: 2500,"columns": [
                    {"data": "EMPLOYEECODE"},{"data": "   INDENTDATE"},{"data": "   INDENTNO"},{"data": "   INDENTSHORTDES"},{"data": "   REGISTEREDDATE"},{"data": "   LINEITEMCODE"}

                ],success: function (result)
                {

                    console.log('complete with success and data:',result.indents);
                    $('#table').bootstrapTable('load',result.indents);

                }
            });
        });

}

coinsIndentsServlet.java

{

     protected void processRequest(HttpServletRequest request,HttpServletResponse response)throws servletexception,IOException {
    response.setContentType("application/json;charset=UTF-8");
    String empid = request.getParameter("empid");

    try (PrintWriter out = response.getWriter()) {

        coinsIndents egpsobj = new coinsIndents();
        JSONObject _output = egpsobj.getIndentDataForGrid(empid);

        out.write(_output.toString());
    }
}

}

我想从数据库获取数据并加载到引导表中, 但问题是,当我将有关该employeeID的employeeID赋予搜索字段时,所有数据都应加载到引导表中。 怎么做?在这里,我将url作为servlet而不是PHP给出,请提出使用servlet而不是PHP的答案。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)