log:
需求及解决的问题:
1.前端表格展示后端接口给的参数
2.input文本框输入参数
3.需要把这些参数二次传给后端接口处理
4.类型不同,前端获取参数的方法不同
var mobile_key= document.getElementById('mobile_key').innerHTML; //获取表格数据
var customer_id=document.getElementById('customer_id').innerHTML;
var mobile = document.getElementById('mobile').value; //获取input文本框数据
{% for i in mobilkey %}
<tr id="mobile12">
<td class="text-center .a1" id="a1">{{i.plat_code}}</td>
<td class="text-center .a2">{{i.third_caption}}</td>
<td class="text-center .a3">{{i.shop_id}}</td>
<td class="text-center .a4" id="mobile_key">{{i.mobile_key}}</td>
<td class="text-center .a5" id="customer_id">{{i.customer_id}}</td>
<td class="text-center .a6">{{i.tenant_id}}</td>
<td class="text-center"><input type="text" name="mobile" id="mobile" title="输入需要加密的手机号"></td>
<td class="text-center">
<div class="layui-btn phone" lay-submit lay-filter="*">加密</div>
<!-- <button onclick="window.location.href='/lp3/md5_mobilekey?mobile_key={{ i.mobile_key }}&customer_id={{i.customer_id}}&tenant_id={{i.tenant_id}}&mobile='+document.getElementById('mobile').value ;if(confirm('加密确认')== false) return false;" style="color: #dc143c" class="" >加密</button>-->
</td>
</tr>
{% endfor %}
<script type="text/javascript">
//搜索结果局部刷新
$(function() {
$('.phone').click(function () {
var mobile_key= document.getElementById('mobile_key').innerHTML;
var customer_id=document.getElementById('customer_id').innerHTML;
var mobile = document.getElementById('mobile').value;
$.ajax({
type: 'GET',
url: '/lp3/md5_mobilekey',
data: {"mobile_key":mobile_key,"customer_id":customer_id,"mobile":mobile},
success: function (data) { // 这个data是接收到的响应的实体
$('.result').val(data["mobile"]);
}
});
});
})
</script>