以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]这个post查询该怎么写?【已解决】 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=120550) |
-- 作者:浙江仔 -- 发布时间:2018/6/19 11:47:00 -- [求助]这个post查询该怎么写?【已解决】 一个网站的查询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编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/6/19 11:57:00 -- 1、使用浏览器调试工具,在【网络】选项卡那里,看看人家post的时候提交了什么信息。你也要提交同样的信息;
2、贴出具体网址测试。 |