一查询网页中的数据提交js如下,该怎么写post代码?
function doSearch() {
$("#certList").html("查询中");
$.ajax({
url: "/examweb/api/v2/certificate/query_json.xhtml",
dataType: "json",
type: "POST",
data: {
"username": $("#studentName").val(),
"idcard": $("#studentCardId").val(),
_: (new Date() - 0)
},
error: function (data) {
$("#certList").html("当前服务器响应可能有问题,请几分钟后再试!");
},
success: function (data) {
var html = '';
console.log(data);
if (data.status == 'success' && data.data != null && data.data.length > 0) {
var render = template.compile("succView", $("#succView").html());
html = render(data);
} else {
html = "对不起,查无结果";
}
$("#certList").html(html);
}
});
}