Callback method after successful DWZ operation

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.