<SCRIPT type = "text/JavaScript">
$ (Function ()
{
$ ("# Btnajaxget"). Click (function (Event)
{
// Send a GET request
$ ("# Divresult"). Load ("../data/ajaxgetmethod. aspx? Param = btnajaxget_click "+" & timestamp = "+ (new date (). gettime ());
});
$ ("# Btnajaxpost"). Click (function (Event)
{
// Send a POST request
$ ("# Divresult"). Load ("../data/ajaxgetmethod. aspx", {"Param": "btnajaxpost_click "});
});
$ ("# Btnajaxcallback"). Click (function (Event)
{
// Send a POST request, and then execute the callback function.
$ ("# Divresult"). Load (".../data/ajaxgetmethod. aspx", {"Param": "btnajaxcallback_click"}, function (responsetext, textstatus, XMLHttpRequest)
{
Responsetext = "add in the callback function! <Br/> "+ responsetext
$ ("# Divresult" ).html (responsetext); // or: Response (this).html (responsetext );
});
});
$ ("# Btnajaxfilthtml"). Click (function (Event)
{
// Send a GET request and filter out the "Anshan" item from the result
$ ("# Divresult"). Load ("../data/ajaxgetcityinfo. aspx? Resulttype = html "+" & timestamp = "+ (new date (). gettime () +" Ul> Li: Not (: Contains ('anshan '))");
});
})
</SCRIPT>
------------------------------------
$ ("# Button1"). Click (function (){
$ ("# Divresult"). Load ($ ("# divresult"). Load ("/demo/ajaxgetmethod. aspx", {"Param": "button#click "});
})
------------------
Function del (OA ){
VaR $ OTR = $ (OA). Parent (). Parent ();
Var key = $ OTR. ATTR ("key ");
If (confirm ("are you sure you want to delete this record? ")){
$. Getjson ("ajaxdeluserinfo. aspx", {ID: Key}, function (data ){
If (data. Success ){
$ OTR. Remove ();
} Else {
Alert (data. errormessage );
}
})
}
}
----------------------------
Protected void page_load (Object sender, eventargs E)
{
If (request ["ID"]! = NULL)
{
Int id = int. parse (request. querystring ["ID"]);
Try
{
Bll. authormanager. deleteauthorbyid (ID );
Response. Write ("{success: True, errormessage :''}");
}
Catch
{
Response. Write ("{success: false, errormessage: 'deletion error! '}");
}
}
}
==============================
Login
$ ("# Btnlogin"). Click (function (){
// Var Params = $ ("# form1"). serialize ();
// Alert (Params );
// $. Ajax (
//{
// Type: "Get ",
// URL: "/demo/loginhandler. aspx ",
// Data: Params,
// Success: function (data ){
// Alert (data );
//}
//})
// $. Get ("/demo/loginhandler. aspx ", {txtuser: $ (" # txtuser "). val (), txtpass: $ ("# txtpass "). val ()}, function (data ){
$. Post ("/demo/loginhandler. aspx ", {txtuser: $ (" # txtuser "). val (), txtpass: $ ("# txtpass "). val ()}, function (data ){
// Data indicates the content returned by the request
Alert (data );
$ ("# Id1" ).html (data );
//});
// $. Getjson ("/demo/loginhandler. aspx ", {txtuser: $ (" # txtuser "). val (), txtpass: $ ("# txtpass "). val ()}, function (josn ){
// Alert (josn. Success );
});
----
Loginhandler. aspx"
Protected void page_load (Object sender, eventargs E)
{
If (request ["txtuser"]! = NULL & request ["txtpass"]! = NULL)
{
String username = request. querystring ["txtuser"];
String Password = request. querystring ["txtpass"];
If (username = "admin" & Password = "123 ")
{
Response. Write ("11111111111"); // {success: true}
}
Else
Response. Write ("22222222222222"); // {success: false}
}
Else
Response. Write ("{success: false }");
}