user2224493
user2224493

Reputation: 269

How to retrieve JSON objects from ASP.NET Web Form

I am passing JSON data to asp.net web form in script. How can I retrieve the id and use in web form

$.ajax({
  type: "GET",
  url: 'Edit.aspx',
  cache: false,
  data: ({
    id: id,
    page: lastDirecotry
  }),
  success: function (data) {
    $("#dialog").html(data);
    $("#dialog").dialog("open");
  }
});

Upvotes: 0

Views: 66

Answers (2)

Nadeemmnn Mohd
Nadeemmnn Mohd

Reputation: 724

in success method you can get data.id to fetch id ,and to fetch page parameter data.page will give you lastDirectory

Upvotes: 0

David
David

Reputation: 219027

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:

{ id: id, page: lastDirecotry }

Then you can get those values server-side from here:

var id = Request.QueryString["id"];
var page = Request.QueryString["page"];

Upvotes: 1

Related Questions