Provides various official and user-released code examples. For code reference, you are welcome to learn how to refresh the dialog using the tp + dwz callback.
/**
* Ajax response for failed operations
* @ Param unknown $ navTabId
* @ Param string $ message
* @ Param string $ statusCode
* @ Param string $ callbackType
* @ Param string $ rel
* @ Param string $ forwardUrl
* @ Param string $ type
*/
Public function ajaxDelReturnFail ($ message = "delete operation failed", $ navTabId = "", $ statusCode = "0", $ callbackType = "", $ rel = "", $ forwardUrl = "", $ type = "JSON ")
{
// Ensure that logs can be saved after AJAX is returned
If (C ('Log _ RECORD ') LOG: save ();
$ Result = array ();
$ Result ['statuscode'] = $ statusCode; // zhanghuihua@msn.com
$ Result ['message'] = $ message; // zhanghuihua@msn.com
$ Result ['navtabid'] = $ navTabId; // zhanghuihua@msn.com
$ Result ['rel '] = $ rel; // zhanghuihua@msn.com
$ Result ['callbacktype'] = $ callbackType; // zhanghuihua@msn.com
$ Result ['forwardurl'] = $ forwardUrl; // zhanghuihua@msn.com
// Return the status information in JSON format to the client.
Header ("Content-Type: text/html; charset = UTF-8 ");
Exit (json_encode ($ result ));
}
/**
* Ajax deletion successful
* @ Param string $ message
* @ Param string $ navTabId
* @ Param string $ statusCode
* @ Param string $ callbackType
* @ Param string $ rel
* @ Param string $ forwardUrl
* @ Param string $ type
*/
Public function ajaxDelReturnSucc ($ navTabId, $ message = "successful deletion", $ statusCode = "1", $ callbackType = "", $ rel = "", $ forwardUrl = "", $ type = "JSON ")
{
// Ensure that logs can be saved after AJAX is returned
If (C ('Log _ RECORD ') LOG: save ();
$ Result = array ();
$ Result ['statuscode'] = $ statusCode; // zhanghuihua@msn.com
$ Result ['message'] = $ message; // zhanghuihua@msn.com
$ Result ['navtabid'] = $ navTabId; // zhanghuihua@msn.com
$ Result ['rel '] = $ rel; // zhanghuihua@msn.com
$ Result ['callbacktype'] = $ callbackType; // zhanghuihua@msn.com
$ Result ['forwardurl'] = $ forwardUrl; // zhanghuihua@msn.com
// Return the status information in JSON format to the client.
Header ("Content-Type: text/html; charset = UTF-8 ");
Exit (json_encode ($ result ));
}
/**
* If the operation is successful, Ajax returns
* (Non-PHPdoc)
* @ See Action: ajaxReturn ()
*/
Public function ajaxInsertReturnSucc ($ navTabId, $ message = "added operation succeeded", $ statusCode = "1", $ callbackType = "closeCurrent", $ rel = "", $ forwardUrl = "", $ type = "JSON ")
{
// Ensure that logs can be saved after AJAX is returned
If (C ('Log _ RECORD ') LOG: save ();
$ Result = array ();
$ Result ['statuscode'] = $ statusCode; // zhanghuihua@msn.com
$ Result ['message'] = $ message; // zhanghuihua@msn.com
$ Result ['navtabid'] = $ navTabId; // zhanghuihua@msn.com
$ Result ['rel '] = $ rel; // zhanghuihua@msn.com
$ Result ['callbacktype'] = $ callbackType; // zhanghuihua@msn.com
$ Result ['forwardurl'] = $ forwardUrl; // zhanghuihua@msn.com
// Return the status information in JSON format to the client.
Header ("Content-Type: text/html; charset = UTF-8 ");
Exit (json_encode ($ result ));
}
/**
* An error occurred while adding the Ajax operation.
* @ Param unknown $ navTabId
* @ Param string $ message
* @ Param string $ statusCode
* @ Param string $ callbackType
* @ Param string $ rel
* @ Param string $ forwardUrl
* @ Param string $ type
*/
Public function ajaxInsertReturnFail ($ message = "failed to add operation", $ navTabId = "", $ statusCode = "0", $ callbackType = "", $ rel = "", $ forwardUrl = "", $ type = "JSON ")
{
// Ensure that logs can be saved after AJAX is returned
If (C ('Log _ RECORD ') LOG: save ();
$ Result = array ();
$ Result ['statuscode'] = $ statusCode; // zhanghuihua@msn.com
$ Result ['message'] = $ message; // zhanghuihua@msn.com
$ Result ['navtabid'] = $ navTabId; // zhanghuihua@msn.com
$ Result ['rel '] = $ rel; // zhanghuihua@msn.com
$ Result ['callbacktype'] = $ callbackType; // zhanghuihua@msn.com
$ Result ['forwardurl'] = $ forwardUrl; // zhanghuihua@msn.com
// Return the status information in JSON format to the client.
Header ("Content-Type: text/html; charset = UTF-8 ");
Exit (json_encode ($ result ));
}
/**
* If the operation is successful, Ajax returns
* (Non-PHPdoc)
* @ See Action: ajaxReturn ()
*/
Public function ajaxUpdateReturnSucc ($ navTabId, $ message = "update operation succeeded", $ statusCode = "1", $ callbackType = "closeCurrent", $ rel = "", $ forwardUrl = "", $ type = "JSON ")
{
// Ensure that logs can be saved after AJAX is returned
If (C ('Log _ RECORD ') LOG: save ();
$ Result = array ();
$ Result ['statuscode'] = $ statusCode; // zhanghuihua@msn.com
$ Result ['message'] = $ message; // zhanghuihua@msn.com
$ Result ['navtabid'] = $ navTabId; // zhanghuihua@msn.com
$ Result ['rel '] = $ rel; // zhanghuihua@msn.com
$ Result ['callbacktype'] = $ callbackType; // zhanghuihua@msn.com
$ Result ['forwardurl'] = $ forwardUrl; // zhanghuihua@msn.com
// Return the status information in JSON format to the client.
Header ("Content-Type: text/html; charset = UTF-8 ");
Exit (json_encode ($ result ));
}
/**
* An error occurred while adding the Ajax operation.
* @ Param unknown $ navTabId
* @ Param string $ message
* @ Param string $ statusCode
* @ Param string $ callbackType
* @ Param string $ rel
* @ Param string $ forwardUrl
* @ Param string $ type
*/
Public function ajaxUpdateReturnFail ($ message = "update operation failed", $ navTabId = "", $ statusCode = "0", $ callbackType = "", $ rel = "", $ forwardUrl = "", $ type = "JSON ")
{
// Ensure that logs can be saved after AJAX is returned
If (C ('Log _ RECORD ') LOG: save ();
$ Result = array ();
$ Result ['statuscode'] = $ statusCode; // zhanghuihua@msn.com
$ Result ['message'] = $ message; // zhanghuihua@msn.com
$ Result ['navtabid'] = $ navTabId; // zhanghuihua@msn.com
$ Result ['rel '] = $ rel; // zhanghuihua@msn.com
$ Result ['callbacktype'] = $ callbackType; // zhanghuihua@msn.com
$ Result ['forwardurl'] = $ forwardUrl; // zhanghuihua@msn.com
// Return the status information in JSON format to the client.
Header ("Content-Type: text/html; charset = UTF-8 ");
Exit (json_encode ($ result ));
}
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB