BeFruit

Tuesday, May 29, 2007

A bridge between JavaScript and C#: AjaxPro

It is now very common to JavaScript programmers to call remote procedures on the server, either directly using the XMLHttpRequest object or a framework ensuring cross-browser compatibility.
What is then missing is the server-side machinery able to answer the request. You have to parse the request parameters, process data and build a return value as a string or an XML document. It is relatively simple as long as you are using basic types, but gets complicated if you want to pass a custom object or a DataGrid.
If you are lucky enough to be using .NET, here comes AjaxPro. You create an .aspx page with a public class MyClass. Add a public method MyMethod with the attribute [AjaxPro.AjaxMethod] and that's all. You are now able to call your remote method from JavaScript MyClass.MyMethod(...) just like if it was locally on client-side.

The best part for me is the following: the AjaxPro project manager is planning to make it compatible with jQuery, i.e. make AjaxPro generate JavaScript proxies with the jQuery framework. This will lead the ease of programming and abstraction level one step further.

Labels: , ,

0 Comments:

Post a Comment



<$I18N$LinksToThisPost>:

Create a Link

<< Home