$. Ajax entry application 2

Source: Internet
Author: User

Front-end

  1. <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <HTML xmlns = "http://www.w3.org/1999/xhtml">
  3. <Head>
  4. <Title> No title page </title>
  5. <Style type = "text/CSS">
  6. . Show {display: block ;}
  7. . Hide {display: none ;}
  8. </Style>
  9. <SCRIPT type = "text/JavaScript" src = "jquery/jquery-1.2.6.js"> </SCRIPT>
  10. <SCRIPT type = "text/JavaScript">
  11. // This method encapsulates the Ajax Method for convenient calling.
  12. Function myajax (){
  13. $. Ajax ({
  14. Type: 'get ',
  15. URL: 'ajax. aspx ',
  16. Data: 'id = 1 name = tree ',
  17. Datatype: 'html ',
  18. Beforesend: beforecall,
  19. Success: callback
  20. });
  21. }
  22. // Method before calling
  23. Function beforecall (){
  24. $ ('# Wait'). addclass ("show"). append ('calling ...');
  25. // Alert (''); // test whether to call
  26. }
  27. // Callback function
  28. Function callback (data ){
  29. $ ('# Response'). append (data );
  30. Certificate ('{wait'}.css ("display", "NONE ");
  31. }
  32. // Onload () event
  33. $ (Function (){
  34. $ ('# Confirm'). Click (myajax );
  35. })
  36. </SCRIPT>
  37. </Head>
  38. <Body>
  39. <Div id = "Confirm"> click </div>
  40. <Div id = "response"> receive background data </div>
  41. <Div id = "wait" class = "hide"> Hello </div>
  42. </Body>
  43. </Html>

Background

  1. Protected void page_load (Object sender, eventargs E)
  2. {
  3. Response. Write ("hello" + request ["name"]);
  4. Response. End ();
  5. }
Related Article

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.