How ASP. NET and Ajax are implemented

Source: Internet
Author: User

ajax should not be a technology, it's a thought, it's not much of a relationship with ASP. NET and other Web development languages, this is just about the Ajax technology currently used in ASP and some other good frameworks for Ajax.
ajax has been popular for a while now, talking about Ajax is a bit corny,-___ __-". At present the so-called Web2.0 website, basically does not use Ajax, just like using RSS, just like a label, posted up to become 2.0. Ajax specific details are not discussed, the purpose is to let users trigger some operations, the page will not be all refreshed, only to refresh the "partial page" to be updated, the process of loading data, with Loading pictures to indicate loading data, not only looks good, but also improves the user's access experience, There's a cool feeling.
ajaxpro is not very convenient to use, the page needs to be in Page_Load Registered inside, similar to

private void Page_Load ( object sender, System.EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax ( typeof (Dataaccess.myajax));
}


and the ASPX page contains a runat=server <Asp:From> tag, so ajax.net will be used in some of the general functions and your custom functions loaded in, if not <Asp:From> can actually, manually add it. However, in the application I have done, often some problems, for example, often found that the browser status bar will have JS script error, and at this time you do the Ajax effect will be all invalidated, the solution is, the Ajax.dll/ajaxpro.dll to re-cover a bit can be, What is the cause of the problem is not yet known.
is there any other solution? You can write some Javascript functions for yourself. However, I recommend here  jQuery  this Javascript framework, from the Baidu Encyclopedia quoted a paragraph of its introduction:

jQuery is another excellent JAVASCRĪPT framework after prototype. Its purpose is--write less,do more, write less code, do more things.
jquery also has a big advantage is that its documentation is very full, and the various applications are described in detail, while there are many mature plug-ins to choose from.
jquery allows the user's HTML page to keep the code and HTML content separate, that is, no longer inserting a bunch of JS in the HTML to invoke the command, just define the ID.


It seems that this introduction you will know that the Ajax effect is only one of the many functions of jQuery, in general, the use of Ajax in WEB applications, must also be inseparable from Javascript, and JQuery is for you to encapsulate a number of JS functions, so you are not in the complexity of JS is worried about, all By JQuery to help you achieve.

If you look at a small example, it is very convenient to do Ajax with JQuery.

For example, there is a Button in an ASPX or HTML page that triggers the Ajax loading data and displays it in <span id=news>. Click on the Button to trigger a JS function:

functionGetnews ()
{
$ ("#News"). html ("Loading News ... ");
$.ajax ({
Type:"post" ,
URL:"/ajax.aspx?act=getnews" ,
DataType:"html" ,
Data:"" ,
Success:function (Result)
{
$ ("#News" ). HTML (result);
}
});
}



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.