将ajax调用的结果放入变量中

时间:2020-12-19 15:42:36

I have two pages we will call page "A" and Page "B". Page A in the root of the server which does not have any ASP access, while page B can do ASP cause it is not in the root directory. What I need to do via ajax is to send a request to Page B from Page A to get the day of the week from the server and put it in a variable for further testing on Page A.

我有两个页面,我们将调用页面“A”和页面“B”。页面A在服务器的根目录中没有任何ASP访问权限,而页面B可以执行ASP,因为它不在根目录中。我需要通过ajax执行的操作是从页面A向页面B发送请求以从服务器获取星期几,并将其放入变量中以便在页面A上进行进一步测试。

This is what I have so far on each page. The code is obviously incomplete on both pages but I am stuck on what to do next or if I am even going in the right direction.

这是我到目前为止每页的内容。代码在两个页面上显然都是不完整的,但我仍然坚持下一步做什么,或者我是否朝着正确的方向前进。

Page A code...

页面代码......

$.get("/v/vspfiles/date.asp");

Page B code...

第B页代码......

<%@LANGUAGE="VBSCRIPT"%>
<% Option Explicit %>
<%=WeekDayName( Weekday( Date ) )%>

I see the ajax call and response in firebug so I know that part is working but do not know how to do the rest, Any help is appreciated.

我在firebug中看到ajax调用和响应,所以我知道该部分正在工作,但不知道如何做其余的事情,任何帮助都表示赞赏。

1 个解决方案

#1


1  

I hope I understood your question correctly, but if you want to get the text response of "/v/vspfiles/date.asp" then the correct way is:

我希望我能正确理解你的问题,但是如果你想获得“/v/vspfiles/date.asp”的文本响应,那么正确的方法是:

$.get("/v/vspfiles/date.asp", null, function(response) {
   /* Here you can use response, which will contain the page's text */
});

#1


1  

I hope I understood your question correctly, but if you want to get the text response of "/v/vspfiles/date.asp" then the correct way is:

我希望我能正确理解你的问题,但是如果你想获得“/v/vspfiles/date.asp”的文本响应,那么正确的方法是:

$.get("/v/vspfiles/date.asp", null, function(response) {
   /* Here you can use response, which will contain the page's text */
});