<style>
div.content{
background-color: #4fbd4f!important;
}
</style>
<div id="tabs-3">
<table id="tbData" class="table table-bordered">
<colgroup>
<col style="width:25%">
<col style="width:25%">
<col style="width:50%">
</colgroup>
<tr>
<th>Host</th>
<th>User</th>
<th>类型</th>
</tr>
<tbody>
</tbody>
</table>
</div>
<div id="tabs-4">
<button id="btn_submit">重新查询</button>
<div id="bbbb"></div>
<script language="javascript">
$('#btn_submit').click(function(){
$("#bbbb").html('正在查询....');
$.get("/deployed",function(data,status){
$("#bbbb").html('查询结束');
console.log(data);
$("#tbData tr td").remove();
console.log("has removed all");
var tempHtml = "";
for(var i = 0; i< data.length; i++)
{
tempHtml += "<tr><td>"+data[i]["host"]+"</td><td>"+data[i]["user"]+"</td><td>"+data[i]["type"]+"</td></tr>";
}
$("#tbData").append(tempHtml);
});
});
</script>
不跳转提交:
1 return false;
2 function submit() {
$('#formid0').off().on('click', function () {
$.ajax({
cache: false,
type: "POST",
url: "/ip_host_detail",
data: $('#formid0').serialize(),
async: true,
success: function (data) {
if (data.status == 'success') {
$('#formid0')[0].reset();
alert("提交成功")
} else if (data.status == 'fail') {
$('#formid0').html(data.msg)
}
}
});
});
}