[RESOLVED]Call the serialized data into webpage2.aspx to deserialize it for use

In Hidden1 there is a serialized json string in webpage1.aspx.cs

I want to call the serialized data into webpage2.aspx to deserialize it for use:

webpage2.aspx

    <script type="text/javascript">
        $.ajax(
             {
                 url: "~/Default.aspx", 
                 contentType: 'application/json',
                 data:  ????     ,
                 dataType: "json",
                 type: "POST"
             }).done(function (result) { });

    </script>

webpage1.aspx.cs

    <form action="webpage2.aspx" method="post">
        <input id="Hidden1" type="hidden" runat="server" />
    </form>

Hi Philsophaie,

For your issue ,here are my suggestions:

Step1 ,Save your serialized json into the session  in your webpage1.cs,code like below:

Step2 ,you can get the serialized json  from the session in your page_load method, then create a new method call "getData"  in your webpage2.cs,deserialize the json.

 [WebMethod]
public string getData(){

  //deserialize the json 
  //return to the page
}

Step3 ,in you webpage2 page ,you can try to use ajax to call the method "getData" ,like below:

$.ajax({
  type:"POST",
  contentType:"application/json;charset=utf-8",
  url:"webpage2.aspx/getData",
  dataType:"json",
 success:function(data){

 }
})

Best  Regards,

Kevin Shen.

Leave a Reply