ajax绑定

function Select() {
var data = $("#SelectByTime").serialize();
$.post(
"settle.aspx?action=Select",
data,
function (ajaxResult) {
if (ajaxResult[2].Value == "True") {
if (ajaxResult[0].Value == "") {
$("#eOrderTbody").html("");
}
else {

$("#eOrderTbody").html($("#tmpl").tmpl(JSON.parse(ajaxResult[0].Value)));
}
}
else {
alert(ajaxResult[0].Value);
if (ajaxResult[1].Value == "Login") {
window.location = "/Web/user/UserLogin.aspx";
}
$("#eOrderTbody").html("");
}
}, "json"
);
};

</script>
<script type="text/x-jquery-tmpl" id="tmpl">
<tr>
<td>${eOrderNumber}</td>
<td>${eUserName}</td>
<td>${eOrderTotalWeight}</td>
<td>${totalPrice}</td>
</tr>
</script>

原文地址:https://www.cnblogs.com/zhouzhe/p/4664335.html