html页面提交JSON,ASP页面接收并打印

jsonSubmit.html

1)能过 javascript函数驱动请求页




	把js的json 传递给asp文件接收并打印
	


	

请求学生

 2)jsonPrint.asp

 接收JSON并解析打印出来对印子项


<%
    dim student
    student=request("student") 
%>


    json <span style="color: #0000ff;">return</span>
    "utf-8">


<%
 '实现读取解析方法自定义函数
Dim scriptCtrl  
Function parseJSON(str)  
    If Not IsObject(scriptCtrl) Then  
        Set scriptCtrl = Server.CreateObject("MSScriptControl.ScriptControl")  
        scriptCtrl.Language = "JScript"  
        scriptCtrl.AddCode "Array.prototype.get = function(x) { return this[x]; }; var result = null;"  
    End If  
    scriptCtrl.ExecuteStatement "result = " & str & ";"  
    Set parseJSON = scriptCtrl.CodeObject.result  
End Function  
%>
<%
    set stuJSON=parseJSON(student)
    Response.Write("学生json原文:"+student+"
") response.Write("

学生姓名:"+stuJSON.name+"

") response.Write("

学生姓名:"+stuJSON.name+"

") response.Write("

学生姓名:"+stuJSON.name+"

") set stuJSON=nothing %>

 

你可能感兴趣的:(html页面提交JSON,ASP页面接收并打印)