asp 用json显示所有数据怎么实现,目前我只能实现一条记录 50
jsonid=request("ID")setadocon=Server.Createobject("adodb.connection")adocon.open"Prov...
jsonid = request("ID")
set adocon = Server.Createobject("adodb.connection")
adocon.open"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("temp.mdb")
set rs=server.createobject("adodb.recordset")
response.write json(jsonid)
'函数json:读取ID为id的记录,将所有字段做成json
Function json(id)
sql="select * from [people_train_code] "
rs.open sql, adocon, 1, 1
json = "{"
For i=0 To rs.fields.count - 1
json = json & chr(34) & rs(i).name & chr(34) & ":"
json = json & chr(34) & rs(i) & chr(34)
If i <> rs.fields.count - 1 Then
json = json & ","
End if
Next
json = json & "}"
rs.close
End Function 展开
set adocon = Server.Createobject("adodb.connection")
adocon.open"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("temp.mdb")
set rs=server.createobject("adodb.recordset")
response.write json(jsonid)
'函数json:读取ID为id的记录,将所有字段做成json
Function json(id)
sql="select * from [people_train_code] "
rs.open sql, adocon, 1, 1
json = "{"
For i=0 To rs.fields.count - 1
json = json & chr(34) & rs(i).name & chr(34) & ":"
json = json & chr(34) & rs(i) & chr(34)
If i <> rs.fields.count - 1 Then
json = json & ","
End if
Next
json = json & "}"
rs.close
End Function 展开
展开全部
var areadata ={
province : [],
city: [],
district: []
}
function initAreaData(){
var dataroot="/scripts/area/areas.json";
$.getJSON(dataroot, function(data){
areadata.province=data.province;
areadata.city=data.city;
areadata.district=data.district;
});
}
province : [],
city: [],
district: []
}
function initAreaData(){
var dataroot="/scripts/area/areas.json";
$.getJSON(dataroot, function(data){
areadata.province=data.province;
areadata.city=data.city;
areadata.district=data.district;
});
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询