1.getUserPower is a custom JavaScript function
Get Permissions
(1). The relative address of the. ASHX handler (must be a relative address)
(2). AU permission name
(3). ClassName Class Name
(4). Funsuccess A successful event, function.
*/
$.fn.getuserpower = function (operate, mdlname, funsuccess) {
$ (this). Click (Function (event) {
if (cookie = = "Admin") {
if (Mdlname = = "Sectioninfomag" | | mdlname = = "Toolssectionmag" | | mdlname = "TOOLSINFOMAG" | | mdlname = "PARAMINFOMAG") {
Alert ("Admin user does not have this permission!") ");
return false;
}
else {
Funsuccess (); Things to do after success
return true;
}
}
Cancels the execution of other event handlers and cancels the event bubbling. If multiple event handlers are bound to the same event, calling this method in one of the event handlers will not continue to invoke other event handlers
Event.stopimmediatepropagation ();
$.get (ashx
, {key: "Byone", Operate:operate, Userid:cookie, mdlname:mdlname}
, function (data, textstatus) {
if (Textstatus = = "Success") {//Get success
if (data = = "true") {
Funsuccess (); Things to do after success
} else if (data = = "false") {
Alert ("No permission! ");
return false;
} else {
alert (data);
return false;
}
} else {
alert (textstatus);
return false;
}
})
});
};
Calls between 2.ashx and Ajax
$ ("#btn_del"). Getuserpower ("Del", "Paraminfomag", function ()
{
var tid = $ (": Checked"). Getbind ("Tid", ",");
if (tid = = "") {
Alert ("Please select the row to delete!");
Return
} else {
Determine if the current user has permission to delete the selected tightening parameter information
$.get (".. /ashx/paraminfomag.ashx? "+ New Date (), {key:" Delpower ", Ids:tid}, function (data, textstatus) {
if (Data! = "true")
{
alert (data);
Return
}
Else
{
if (!confirm ("Are you sure you want to delete? ")) {
Return
}
$.get (".. /ashx/paraminfomag.ashx? "+ New Date (), {key:" Del ", Ids:tid}, function (data, textstatus) {
if (Textstatus = = "Success") {
if (data = = "true") {
Alert ("Delete succeeded! ");
$ ("#img_sel"). Click ();
window.location = "paraminfo.aspx";
} else if (data = = "false") {
Alert ("Delete failed! ");
} else {
alert (data);
}
} else {
alert (textstatus);
}
}); Get
}
});
}
});
ASHX Ajax with custom JavaScript functions