亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        asp 讀取 json 列表解決思路

        字號:


            怎么用asp程序讀取url再用程序讀取出結(jié)果,求完整asp程序
            ------解決方案--------------------
            原來不是發(fā)過了?知識變成數(shù)組了而且,方法都差不多
            <script runat=server language=jscript>
            function getjson(v) { return eval('(' + v + ')'); }
            function toarray(a) {//json對象數(shù)組格式的字符串
            var dic = server.createobject(scripting.dictionary);
            for (var i = 0; i < a.length; i++) {
            var obj = server.createobject(scripting.dictionary);
            for (x in a[i]) obj.add(x, a[i][x]);
            dic.add(i, obj);
            }
            return dic;
            }
            </script>
            <%
            '==================================================
            '從2進(jìn)制數(shù)據(jù)流生成內(nèi)容
            '==================================================
            function bytestobstr(strbody,codebase)
            dim obj
            set obj=server.createobject(adodb.stream)
            obj.type=1
            obj.mode=3
            obj.open
            obj.write strbody
            obj.position=0
            obj.type=2
            obj.charset=codebase
            bytestobstr=obj.readtext
            obj.close
            set obj=nothing
            end function
            function downpage(url)
            set xhr=server.createobject(microsoft.xmlhttp)
            xhr.open get,url,false
            xhr.send
            downpage=bytestobstr(xhr.responsebody,gb2312)'注意你那個(gè)頁面的編碼,要不可能出亂碼
            end function
            's改為用microsoft.xmlhttp動態(tài)獲取
            's=downpage()
            s={resultcode:200,reason:return successd,result:[{id:1,province:陜西省,city:西安市,area:灞橋區(qū),address:狄寨鎮(zhèn)南寨村},{id:2,province:陜西省,city:西安市,area:灞橋區(qū),address:狄寨鎮(zhèn)潘村}
            ,{id:3,province:陜西省,city:西安市,area:灞橋區(qū),address:狄寨鎮(zhèn)伍坊村}],error_code:0}
            set o=getjson(s)
            if o.resultcode=200 then
            set result=toarray(o.result)
            for i=0 to result.count-1
            response.write result(i)(province)&-&result(i)(address)&<br/>
            next
            set result=nothing
            end if
            set o=nothing
            %>