简体   繁体   English

如何使用asp.net中的ajax将控件的值从一页传递到另一页

[英]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#. 我试图使用c#在asp.net中使用ajax将控件(例如文本框)的值从一页传递到另一页。

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..........
                     }
               });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在asp.net中将图像从一页传递到另一页 - how to pass image from one page to another in asp.net 如何在asp.net c#中将GridView的值从一个页面传递到另一个页面? - How to pass value of GridView from one page to another in asp.net c#? 当您在 ASP.NET 2.0 中使用登录控件时,将值或数据从一个页面传递到另一个页面 - pass values or data from one page to another when you use Login control in ASP.NET 2.0 将 ASP.Net GridView 从一个页面传递到另一个页面 - Pass ASP.Net GridView from one page to another page 无法在asp.net中将参数从一页传递到另一页 - Cant pass parameter from one page to another in asp.net 如何在ASP.NET MVC中将所选项目从一页传递到另一页 - How do I Pass Selected items from one page to another page in asp.net mvc 如何将hiddenfield值传递到asp.net中的另一页? - How to pass hiddenfield value to another page in asp.net? 如何将值从Querystring传递给asp.net登录控件 - How to pass value from Querystring to asp.net Login control 如何使用剃刀页面在 ASP.Net Core 上将对象从一个页面传递到另一个页面? - How pass objects from one page to another on ASP.Net Core with razor pages? 如何使用 ASP.NET MVC 和 SQL 服务器将表字段值从一个表传递或复制到另一个表 - How to pass or copy table field value from one table to another table using ASP.NET MVC and SQL Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM