Get started with the ajaxpro code
Ajax. net Professional (ajaxpro) is a Ajax framework for the Microsoft. net Framework which you can use with any. NET language like C #, VB. net, J # To create javascript proxies to invoke any. net method from the client-side. download the ajaxpro.2.dll (. NET 2.0) from http://www.ajaxpro.info/, add the reference and setup the web. config:
<Configuration> <Location Path = "ajaxpro"> <system. web>
Next we need to write our. net method that will return the data we will ask. A simple static method can be used with nearly any. NET data type, but I recommend to use only structs/classes with JavaScript similar data types for the properties.
Namespace mynamespace {public class myclass {[ajaxpro. ajaxmethod] public static string helloworld (string s) {return "hello" + S ;}}}
[Edit]
The Ajax endpoint
To get the name of the Ajax request endpoint you must use the namespace, classname and the Assembly name like below:
String Path = "/ajaxpro/mynamespace. myclass, "; Path + = typeof (myclass ). assembly. fullname. split (',') [0]; Path + = ". ashx ";
Write the above string to a javascript variable using registerhiddenfield or any other way.
[Edit]
Run the ajaxpro request
The next step wocould be to use jquery to invoke the ajaxpro request. I used a very simple example to show what you need.
$. Ajax ({type: "Post", URL: myajaxpath, // This is the path from above data: '{"S": "Hans"}', beforesend: function (xhr) {xhr. setRequestHeader ("X-ajaxpro-method", "helloworld") ;}, success: function (s) {var o = NULL; eval ("O =" + S + "*" + "/"); alert (o );}});