简体   繁体   中英

how to pass a value of a control from one page to another using ajax in asp.net

I am trying to pass a value of a control(For example a textbox) from one page to another using ajax in asp.net with c#.

any suggestions

<input type="text" id="txt">
<input type="Submit" id="btn">

<script>
$(document).ready(function()({
           $("#btn").click(function() {
                  Var textData = $("#txt").val();
                  $.ajax({
                      url:"Home/Index/" //In case of MVC.
                      type:'get'
                      data:{data:textData}
                      success: function() { 
                           Your code..........
                     }
               });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM