jquery - Posting data and pulling the result
问题描述
I am using Jquery to push pass data too a .asp page, hoping to return some data back.
I have tried sending normal string data across and it works fine.
Jquery:
$.post("Ajax/DisplayQuery.asp", { SQLquery: $('#SQLstring').text() }, function (data1, status) { // Post query name to data page
var str1 = data1;
var res1 = str1.split(" | "); // Remove the pipe delimiter
var workers1 = res1;
alert("Columns: " + workers1);
})
.ASP page
on error resume next
dim rs1
Set rs1 = doSQL("request.form("SQLquery")")
Dim fld As DAO.Field
For Each fld In rs1.Fields
response.Write " | " & fld.Name
Next
Set fld = Nothing
if err.number > 0 then
response.Write ("ERROR: " & err.Description)
end if
From my Jquery, I'm trying to get an alert to pop-up, the pop-up does show if I send plain string text through.
The below contains an SQL query which is what I am actually passing through
{ SQLquery: $('#SQLstring').text() }
解决方案
@ADyson 建议我查看检查元素工具中的网络选项卡。这有助于识别代码中的 2 个问题。
语法问题,需要删除引号,留下以下内容:
doSQL(request.form("SQLquery"))
我还必须从这一行中删除 As DAO.Field:
Dim fld As DAO.Field
推荐阅读
- python-3.x - 如何使用 Chrome 驱动程序通过 Python 和 Selenium 在指定位置下载文件
- python - 从字典创建熊猫数据框,同时保持列的顺序
- python - _curses.error: prefresh() 返回 ERR
- python-3.x - 如何在 flask-RESTPlus 中获取资源路径?
- dll - 两个具有相同 bas 模块的 VB6 项目 - 一个编译另一个不编译 - 1 行代码
- java - 如何有效地在硒中等待很长时间
- c - 覆盖树视图中使用的图标
- excel - Vlookup 函数生成重复值,请问我该如何解决?
- django - 如何在 CreateAPIView 中引发 HttpResponseForbidden
- python - django 忽略 url 中的斜杠并获取参数