首页 > 解决方案 > 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() }

标签: jqueryajaxasp-classic

解决方案


@ADyson 建议我查看检查元素工具中的网络选项卡。这有助于识别代码中的 2 个问题。

语法问题,需要删除引号,留下以下内容:

doSQL(request.form("SQLquery"))

我还必须从这一行中删除 As DAO.Field:

Dim fld As DAO.Field

推荐阅读