json 文本框如何联动填写信息?

后台已经封装好了json数据,请问如何做到用户填写deviceid后,自动填写与deviceid关联的deviceid_name 和brand?

 <tr id="tOutWarehouseSlaveList{{idx}}">

                            <td>
                                <input path ="tInventoryTable"  id="tOutWarehouseSlaveList{{idx}}_deviceid" name="tOutWarehouseSlaveList[{{idx}}].deviceid" type="text" value="{{row.deviceid}}" maxlength="255" class="input-small " onblur = "tInventoryTableInfo()"/>
                            </td>
                            <td>
                                <input id="tOutWarehouseSlaveList{{idx}}_devicename" name="tOutWarehouseSlaveList[{{idx}}].devicename" type="text" value="{{row.devicename}}" maxlength="255" class="input-small "/>
                            </td>
                            <td>
                                <input id="tOutWarehouseSlaveList{{idx}}_brand" name="tOutWarehouseSlaveList[{{idx}}].brand" type="text" value="{{row.brand}}" maxlength="255" class="input-small "/>
                            </td>
                            </tr>

tInventoryTableInfo用ajax发送输入的信息到服务器,服务器通过参数读取信息返回,ajax获取返回值后设置控件的值即可

 <script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
<tr id="tOutWarehouseSlaveList{{idx}}">

    <td>
        <input path="tInventoryTable" id="tOutWarehouseSlaveList{{idx}}_deviceid" name="tOutWarehouseSlaveList[{{idx}}].deviceid" type="text" value="{{row.deviceid}}" maxlength="255" class="input-small " onblur="tInventoryTableInfo(this)" />
    </td>
    <td>
        <input id="tOutWarehouseSlaveList{{idx}}_devicename" name="tOutWarehouseSlaveList[{{idx}}].devicename" type="text" value="{{row.devicename}}" maxlength="255" class="input-small " />
    </td>
    <td>
        <input id="tOutWarehouseSlaveList{{idx}}_brand" name="tOutWarehouseSlaveList[{{idx}}].brand" type="text" value="{{row.brand}}" maxlength="255" class="input-small " />
    </td>
</tr>
<script>
    function tInventoryTableInfo(el) {
        if (el.value != '')
            $.get('xxxx.url', { id: id }, function (d) {//xxxx.url获取id参数查询数据库后返回 用|分隔的内容就行了。第一个为devicename,第二个为brand
                var arr = d.split('|'),ipt=$(el).closest('tr').find('input')
                ipt[1].value = arr[0]; ipt[2].value = arr[1];
            });
    }
</script>