有一个页面 index.aspx
在它的 index.aspx.cs的load事件里,返回了一个JOSN
在页面如何使用datagrid接收到?
index.aspx <table id=datagrid></table>
C#:
这就是一个webservice的调用
在它的 index.aspx.cs的load事件里,返回了一个JOSN
在页面如何使用datagrid接收到?
index.aspx <table id=datagrid></table>
index.aspx.cs public page_load(response.write(json))
分析:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
$.ajax({
async:
false
,
type:
"POST"
,
url:
"index.aspx/GetGuige"
,
//后面是方法名
data:
'{lid:"'
+ lid +
'"}'
,
dataType:
"json"
,
contentType:
"application/json; charset=gb2312"
,
success:
function
(msg) {
$(
"#guige"
).html(msg.d);
}
});
|
C#:
1
2
3
4
5
6
7
8
9
|
[System.Web.Services.WebMethod()]
public
static
string
GetGuige(
string
lid)
{
System.Text.StringBuilder str =
new
System.Text.StringBuilder();
return
str.ToString();
}
|
这就是一个webservice的调用