Ajax.net
笔记而已,差点忘记了,再看一次:
配置ajax.net:
用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 !
配置ajax.net:
<configuration>
<system.web>
<httpHandlers>
<add verb="POST,GET" path="
type="Ajax.PageHandlerFactory,
</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 !
posted on 2006-05-10 15:19 flyingchen 阅读(653) 评论(0) 收藏 举报
浙公网安备 33010602011771号