ASP. net ajax series (II)

Source: Internet
Author: User

ASP. net ajax series (II)
In the last Ajax operation, we used the native ASP. NET control, but it has many drawbacks and is inefficient. In addition, there is a file upload BUG: http://blog.csdn.net/zhaoqiliang527/article/details/4457961 . So we seek a better implementation method. jQuery's Ajax method works with the general ashx processing program. The advantage of jQuery is its strong compatibility (there is a team dedicated to development behind it). It is easy to use (I learned how to find an API in just a few minutes) and has powerful functions (encapsulated native js, you can call a method to implement many functions ). Generally, the Ashx processing program is MS's own. It can be seen from its name that it is used to handle something (forgive me for being easy to learn ), in addition, it does not reconstruct the lifecycle of the entire page during execution, which avoids the overhead problem caused by Control tree generation. Now let's talk about how the two can be combined to implement ajax. First, we should build a page: copy the Code <% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "ashxAjax. aspx. cs "Inherits =" WebApplication1.ashxAjax "%> <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns =" http://www.w3.org/1999/xhtml "> <Head runat =" server "> <title> jQuery Ajax </title> <script type =" text/javascript "src =" JavaScript/jquery-11.js "> </script> <script type = "text/javascript"> $ (function () {$ ("# txtId "). blur (function () {var a =$ ("# txtId "). val (); $. ajax ({type: "post", url: "Handler1.ashx", data: {m: a}, success: function (result) {var res = result. toString (); $ ("# lblShow" ).html (res) ;}}) ;}); </script>

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.