Advertisement
Guest User

Untitled

a guest
May 19th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. // do NOT include validate session...the validation is done in the
  3. // constuctor of AjaxResponse
  4. //
  5. require_once(dirname(__FILE__) . "/../../core/globalSettings.php");
  6.  
  7. $ajaxResponse = new AjaxResponse($_POST);
  8.  
  9. switch ($ajaxResponse->getMethod()) {
  10.   case "your method" :
  11.  
  12.     //
  13.     // YOUR CODE:
  14.     //
  15.     // You could read a parameter passed from the client
  16.     //
  17.  
  18.     $param = $ajaxResponse->getParameter("key");
  19.  
  20.     //
  21.     // YOUR CODE:
  22.     //
  23.     // You could create an object to be returned to the client
  24.     // $resultObj MUST BE AN ASSOCIATIVE ARRAY OR AN OBJECT
  25.     //
  26.     // $resultObj = ...
  27.     // $ajaxResponse->setResult($resultObj);
  28.  
  29.     $ajaxResponse->setSuccess(true);
  30.     break;
  31.   default:
  32.     $ajaxResponse->setSuccess(false);
  33.     $ajaxResponse->setMessage(_mb("An unknown error occured."));
  34.     break;
  35. }
  36. $ajaxResponse->send();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement