Foxtable(狐表)用户栏目专家坐堂 → [求助]怎么把json数据post出去


  共有1923人关注过本帖平板打印复制链接

主题:[求助]怎么把json数据post出去

帅哥哟,离线,有人找我吗?
浙江仔
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1316 积分:9484 威望:0 精华:1 注册:2010/7/21 14:20:00
[求助]怎么把json数据post出去  发帖心情 Post By:2019/5/16 10:52:00 [只看该作者]

一查询网页中的数据提交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);
            }
        });
    }

 回到顶部