Get Classic ASP variable from posted JSON

后端 未结 8 1991
挽巷
挽巷 2021-02-08 11:01

I\'m trying to post JSON via AJAX to a Classic ASP page, which retrieves the value, checks a database and returns JSON to the original page.

I can post JSON via AJAX. I

8条回答
  •  南笙
    南笙 (楼主)
    2021-02-08 11:19

    You may consider switching from VBScript to JScript (JScript is what microsoft calls JavaScript).

    Why? Because then from within Classic ASP you can do the same JSON calls that the browser can do and read the results into JavaScript objects using the eval() statement.

    Paddy Said: I don't have an answer, but you have my every sympathy... classic asp and JSON handling - sounds like fun.

    @Paddy: Classic ASP and JSON IS fun, in fact it ROCKS! (If you switch from VBScript and use JScript.)

    Note that you don't have to quit VBScript cold-turkey, you can still interoperate between the two in the same ASP file but if you declare JScript first you need to confine your VBScript to SUB or functions and vice-versa otherwise unpredictable things can happen.

    Here's a quick example of what I'm talking about:

    <%@ LANGUAGE="JScript" %>
    <%
    
    var days = VBDateDiff("d", "4/10/2010", "5/3/2010");
    Response.write("JScript Calling VBScript function: days = " + days);
    
    
    %>  <%        
    
    %>  
    

提交回复
热议问题