errorHandlingTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. require_once("../xajax.inc.php");
  3. $xajax = new xajax();
  4. //$xajax->debugOn();
  5. $xajax->errorHandlerOn();
  6. $xajax->setLogFile("xajax_error_log.log");
  7. function myErrorRiddenFunction()
  8. {
  9. $value = $silly['nuts'];
  10. $objResponse = new xajaxResponse();
  11. $objResponse->addAlert("Bad array value: $value");
  12. include("file_doesnt_exist.php");
  13. return $objResponse->getXML();
  14. }
  15. $xajax->registerFunction("myErrorRiddenFunction");
  16. $xajax->processRequests();
  17. ?>
  18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  19. "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
  20. <html xmlns="http://www.w3.org/1999/xhtml">
  21. <head>
  22. <title>Error Handling Test | xajax Tests</title>
  23. <?php $xajax->printJavascript("../") ?>
  24. </head>
  25. <body>
  26. <h2><a href="index.php">xajax Tests</a></h2>
  27. <h1>Error Handling Test</h1>
  28. <form id="testForm1" onsubmit="return false;">
  29. <p><input type="submit" value="Call Error Ridden Function" onclick="xajax_myErrorRiddenFunction(); return false;" /></p>
  30. </form>
  31. <div id="submittedDiv"></div>
  32. </body>
  33. </html>