Copy codeThe Code is as follows: <script type = "text/javascript">
/* Request Ajax with a return value, and a prompt box is displayed.
--------------------------------------------------*/
Function getAjax (url, parm, callBack ){
$. Ajax ({
Type: 'post ',
DataType: "text ",
Url: url,
Data: parm,
Cache: false,
Async: false,
Success: function (msg ){
CallBack (msg );
}
});
}
/* Delete
/* Url: Request Path
--------------------------------------------------*/
Function DeleteData (url, id ){
Var parm = 'Active = Del & id = '+ id;
If (id = undefined | id = ""){
ShowAlertMsg ('select the row to delete ');
} Else {
ShowConfirmMsg ("this operation cannot be recovered. Are you sure you want to delete it? ", Function (r ){
If (r ){
GetAjax (url, parm, function (rs ){
If (parseInt (rs)> 0 ){
ShowOverAlertMsg ("deleted successfully! ", 2000, 4 );
} Else if (parseInt (rs) = 0 ){
ShowOverAlertMsg ("this data is associated and cannot be deleted! ", 2000, 3 );
}
Else {
ShowOverAlertMsg ("deletion failed! ", 2000, 5 );
}
});
}
});
}
}
How to call
// Delete
Function DeleteOnclick (){
DeleteData ('sysmenu _ List. aspx ', Menu_Id );
}
</Script>