I am passing JSON data to asp.net web form in script. How can I retrieve the id and use in web form
我在脚本中将JSON数据传递给asp.net Web表单。如何检索ID并在Web表单中使用
$.ajax({
type: "GET",
url: 'Edit.aspx',
cache: false,
data: ({
id: id,
page: lastDirecotry
}),
success: function (data) {
$("#dialog").html(data);
$("#dialog").dialog("open");
}
});
2 个解决方案
#1
1
This is the key piece of information:
这是关键信息:
type: "GET"
Since this is a GET request, the data is going to be query string key/value pairs. So if this is the data being sent:
由于这是一个GET请求,因此数据将成为查询字符串键/值对。所以,如果这是发送的数据:
{ id: id, page: lastDirecotry }
Then you can get those values server-side from here:
然后,您可以从此处获取服务器端的值:
var id = Request.QueryString["id"];
var page = Request.QueryString["page"];
#2
0
in success method you can get data.id to fetch id ,and to fetch page parameter data.page will give you lastDirectory
在success方法中你可以获取data.id来获取id,并获取页面参数data.page将给你lastDirectory
#1
1
This is the key piece of information:
这是关键信息:
type: "GET"
Since this is a GET request, the data is going to be query string key/value pairs. So if this is the data being sent:
由于这是一个GET请求,因此数据将成为查询字符串键/值对。所以,如果这是发送的数据:
{ id: id, page: lastDirecotry }
Then you can get those values server-side from here:
然后,您可以从此处获取服务器端的值:
var id = Request.QueryString["id"];
var page = Request.QueryString["page"];
#2
0
in success method you can get data.id to fetch id ,and to fetch page parameter data.page will give you lastDirectory
在success方法中你可以获取data.id来获取id,并获取页面参数data.page将给你lastDirectory