1 2 3 4 下一页 H.E. Pennypacker Newbie ReGIStered: 2006-11-13 Posts: 6 I am using Zend Framework 0.20 and Xajax 0.5. I am having issues with a simple hello world example. I just get the generic "The XML response from the server was invalid.." message so it's not helping at all. I have a very simple hello world. Here is my controller code: Code: PHP <?php class HelloWorldController extends Zend_Controller_Action { function indexAction() { $xajax = new xajax(); $xajax->registerFunction(array("doAlert", $this, "doAlert")); $xajax->processRequest(); $view = Zend::registry("view"); $view->title = "Hello World"; $view->xajaxJs = $xajax->getJavaScript("/js/", "xajax.js"); echo $view->render("HelloWorld.php"); } function noRouteAction() { echo "No Route!"; } function doAlert() { $objResponse = new xajaxResponse(); $objResponse->alert("Whaaaaaaaa"); return $objResponse; } } ?>
Here is the HTML file (HelloWorld.php): Code: PHP <html> <head> <?= $this->xajaxJs; ?> <title><?= $this->escape($this->title); ?></title> <link rel="stylesheet" type="text/css" href="/css/jog.css" /> </head> <body> <div id="content"> <h1><?= $this->escape($this->title); ?></h1> <input type="button" value="Execute Xajax Alert" onClick="xajax_doAlert();" /> </div> </body> </html>
(责任编辑:admin) |