Calling the background method in an ASP. JQuery Event

Source: Internet
Author: User

Using JS to invoke the background write method


1<script src="Js/jquery-1.7.1.min.js"></script>2  2<script>3  3$ (function () {4  4$(". BTN"). Click (function () {5  5$("#txtname"). Val ('<%=session["Name"]%>');6  6$("#txtdate"). Val ('<%=getdate ()%>');7  7$("#txtnum"). Val ('<%=getnum ()%>');8  8             });9  9         });Ten Ten</script> One  One  A  A  -  -  -  -  the  the<body> -  -<form id="Form1"runat="Server"> -  -<div> -  -<asp:textbox id="txtname"runat="Server"></asp:textbox><br/> +  +<asp:textbox id="txtdate"runat="Server"></asp:textbox><br/> -  -<asp:textbox id="Txtnum"runat="Server"></asp:TextBox> +  +<input type="Button"  class="btn"Value="Submit"/> A  A</div> at  at</form> -  -</body>
Front Code

1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4 usingsystem.web;5 usingSystem.Web.UI;6 usingSystem.Web.UI.WebControls;7 8 namespaceTest9 {Ten      Public Partial classForeground Call backstage method: System.Web.UI.Page One     { A         protected voidPage_Load (Objectsender, EventArgs e) -         { -session["Name"] ="Dawn"; the         } -          Public Static stringGetnum () -         { -             stringnum ="Zhang San"; +             returnnum; -         } +          Public stringGetDate () A         { at             stringDate = System.DateTime.Now.ToString ("YYYY-MM-DD"); -             returndate; -         } -     } -}
Background Code

Calling the background method in an ASP. JQuery Event

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.