从文本框中的选择下拉列表中获取数据库中的值

时间:2016-01-06 05:48:21

标签: javascript jquery hibernate

请回答以下问题

我想在选择选项时从数据库中获取详细信息并相应地显示相关选择选项的值

 <table border="1" class="form" id="dataTable">
            <tbody>
                <tr class="vd_bg-green vd_white" id='row_0'>
                    <td><input name="chk" type="checkbox"></td>
                    <td><select id="product_name" name="product_name" oninput=
                    "calculate('row_0')" required="" style="width: 180px; color: black">
                    <option>//options from database</option>
                    </select></td>
                    <td><input id="description" maxlength="70" name="description" oninput=
                    "calculate('row_0')" required="" style="width: 260px; color: black" type=
                    "text"></td>
                    <td><input id="price" name="price" oninput="calculate('row_0')" required=""
                    style="width: 80px; color: black" type="text"></td>
                    <td><input id="quantity" name="quantity" oninput="calculate('row_0')"
                    required="" style="width: 40px; color: black" type="text"></td>
                    <td><input id="disc_rate" name="disc_rate" oninput="calculate('row_0')"
                    required="" style="width: 40px; color: black" type="text"></td>
                    <td><input id="total_pro" name="total_pro" onchange="calculate('row_0')"
                    readonly="readonly" style="width: 80px; color: black" type="text"></td>
                </tr>
            </tbody>
        </table>

1 个答案:

答案 0 :(得分:0)

您可以开始学习ajax和服务器端脚本。创建服务器端代码。通过ajax将选定的值传递给它。从数据库中获取结果。在文本框中显示结果。

相关问题