AjaxPro Quick Start

Source: Internet
Author: User
Original article address: http://www.ajaxpro.info/quickguide.aspxajaxproquick start

Because I cannot write a lot of user documents, this article only tells you how to use AjaxPro:

  • You can download the latest Ajax. NET Professional file from the www.schwarz-interactive.de
  • Add reference AjaxPro.2.dll to your project (use AjaxPro. dll for. NET 1.1 Framework)
  • Add the following content to your web. config:
<?xml version="1.0" encoding="utf-8" ?><configuration>  <system.web>      [...]  </system.web></configuration>
  • Now you can use the AjaxMethod property to add your. NET method:
[AjaxPro.AjaxMethod]public DateTime GetServerTime(){  return DateTime.Now;}
  • To use JavaScript on the client to call your. net method, you must register your page class to Ajax. NET:
namespace MyDemo{  public class _Default  {    protected void Page_Load(object sender, EventArgs e)    {      AjaxPro.Utility.RegisterTypeForAjax(typeof(_Default));    }    [AjaxPro.AjaxMethod]    public DateTime GetServerTime()    {      return DateTime.Now;    }  }}
  • You can use JavaScript Asynchronous Method on the client to call your. net method:
Function getServerTime () {MyDemo. _ Default. GetServerTime (getServerTime_callback); // asynchronous call} // after this method is executed, the following method will be called
// The result will be returned to the client function getServerTime_callback (res) {alert (res. value );}
 
  
  • You can also use the JavaScript synchronization method on the client to call your. net method:
function getServerTime(){  alert(MyDemo._Default.GetServerTime().value;  
}

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.