现在的位置: 首页 > 综合 > 正文

Ajax.net

2011年12月15日 ⁄ 综合 ⁄ 共 1144字 ⁄ 字号 评论关闭
笔记而已,差点忘记了,再看一次:

配置ajax.net:

<configuration>

  <system.web>

    <httpHandlers>

      <add verb="POST,GET" path="ajax/*.ashx"
          
type="
Ajax.PageHandlerFactory, Ajax" />

    </httpHandlers> 

    ...

  <system.web>

</configuration>

//C#

public class Index : System.Web.UI.Page{

   private void Page_Load(object sender, EventArgs e){

      Ajax.Utility.RegisterTypeForAjax(typeof(Index));     

      //...                                 

   }

   //... 

}
用ajax.net做了个(C#写的),几点体会,或是过程:
1.
[AjaxMethod()]
public void MethodYouWant()
{
//do as before
return;
}
2.
write client-side
//call the server
function getServer()
{
/*
the first parameter is the parameter needed in serverMethod
the second parameter is the callback meathod name
*/
ClassNameInServer.Method(list of parameter,callback_getServer);
}
/*call back method , that do with form,document,window,or others*/
/* response is only a flay ,you can also use res,ect
but , you must know the value contains parts:request,
error,value
*/
function callback_getServer(response)
{
//only a examply
document.write(response.value.toString());
}
ok now ,you can try .
Maybe I forget to say that you must configu the ajax.net before you use .these information you can find in some websites.

When I finished , I really thought ajax is coming to me now !

Good luck !

抱歉!评论已关闭.