Ajax Pro Setup & Usage Guide
Ajax (Asynchronous JavaScript and XML) is a technology used for asynchronous communication on web pages, allowing web applications to exchange data with servers without refreshing the entire page. Here are the configuration and usage steps for Ajax Pro.
Instructions for setting up:
- Download Ajax Pro: Get the latest version from the official website.
- Unzip the files: Extract the downloaded Ajax Pro files into your project folder.
- Introducing Ajax Pro library: Include the JavaScript file of Ajax Pro library in your webpage.
Steps to follow: 1) Create a server-side method: Create a public method in your server-side code and mark it with the [AjaxPro.AjaxMethod] attribute so that it can be called via Ajax.
For example, let’s say you have a method called “GetTime” that is used to retrieve the current time.
[AjaxPro.AjaxMethod]
public string GetTime()
{
return DateTime.Now.ToString();
}
Call server-side methods in front-end page: Use the AjaxPro JavaScript library in your front-end page to invoke server-side methods.
For example, in a button click event, calling the “GetTime” method and displaying the result on the page.
function getTime() {
MyPageNamespace.MyPageProxy.GetTime(function(result) {
alert(result);
});
}
MyPageNamespace.MyPageProxy is a dynamically generated proxy object through Ajax Pro, which allows you to call server-side methods.
Test the application: Open your page in a browser and verify if the server-side methods are being successfully invoked.
Important points to note:
- Make sure your server-side method is public and that the returned data type can be properly handled by Ajax Pro.
- Make sure that your page has correctly included the Ajax Pro JavaScript file.
- When configuring and using Ajax Pro, you may also need to consider issues like cross-origin access and security.
Here are the basic configurations and steps for using Ajax Pro. You can further explore and expand the functionality of Ajax Pro based on specific needs.