Foxtable(狐表)用户栏目专家坐堂 → [求助]这个post查询该怎么写?【已解决】


  共有1630人关注过本帖树形打印复制链接

主题:[求助]这个post查询该怎么写?【已解决】

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


加好友 发短信
等级:六尾狐 帖子:1316 积分:9484 威望:0 精华:1 注册:2010/7/21 14:20:00
[求助]这个post查询该怎么写?【已解决】  发帖心情 Post By:2018/6/19 11:47:00 [只看该作者]

一个网站的查询js是这样的,如果我要调用,我该怎么写?
之前的js代码不是这样的,我用论坛的一个方法可行,最近这个网址改动了,不知道怎么去调用了?


Tables("信息查询_table1").filter="第一列 ='null'"   ''" & name & "' "
Dim name As String=Functions.Execute("utf8",e.Form.controls("TextBox1").text)
Dim id As String=e.Form.controls("TextBox2").text

Dim time As String =DateDiff("s", "01/01/1970 00:00:00", Now())
Dim msg As String = "examCertVo.studentName=" & name &"&examCertVo.studentCode=" & id & "&_=" & time
Dim req = System.Net.WebRequest.Create("http://域名/examweb/api/v2/certificate/query_json.xhtml")
req.Method = "POST"
req.Timeout = 5000
req.C
Dim aryBuf As Byte() = Encoding.GetEncoding("GB2312").GetBytes(msg)
req.ContentLength = aryBuf.Length
Dim writer = req.GetRequestStream()
writer.Write(aryBuf, 0, aryBuf.Length)
writer.Close()
writer.Dispose()
Dim pos = req.GetResponse
Dim stm As System.IO.Stream = pos.GetResponseStream()
Dim reader As New System.IO.StreamReader(stm)
Dim str As String = reader.ReadToEnd
pos.Close
stm.Close
reader.close
'msgbox(str)

Dim json As String = str



以下是查询网站js代码: 

 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);
      }
    });
  }

  $(function () {
    // 注册 helper
    template.helper("date", function (val) {
      return firebird.date.format({
        time: val,
        format: "yyyy-M-d"
      });
    });

    template.helper("def", function (val, def) {
      return val || (def || "");
    });

    template.helper("sex", function (val) {
      if (val == '男' || val == '女') {
        return val;
      }
      return val == '1' ? '男' : '女';
    });
  });
[此贴子已经被作者于2018/6/19 13:57:34编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/6/19 11:57:00 [只看该作者]

1、使用浏览器调试工具,在【网络】选项卡那里,看看人家post的时候提交了什么信息。你也要提交同样的信息;

 

2、贴出具体网址测试。


 回到顶部