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
HelloWorldController extends Zend_Controller_Action {
function indexAction![](/icons/11739kh.gif)
{
$xajax =
xajax
;
$xajax->registerFunction(
.gif' />("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![](/icons/11739kh.gif)
{
echo "No Route!";
}
function doAlert![](/icons/11739kh.gif)
{
$objResponse =
xajaxResponse
;
$objResponse->alert("Whaaaaaaaa");
$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" _disibledevent=> 0
I'm just running this off a standard php 5.1.6 wamp
![](/icons/11739install.gif)
CrazyLegz
Newbie
Registered: 2007-02-28
Posts: 3
Hi, I had the same problem and found a solution.
嘿
![](/icons/11739dou.gif)
![](/icons/11739de.gif)
![](/icons/11739de.gif)
![](/icons/11739dou2.gif)
I'm using Zend Framework 0.8.0 and xajax 0.2.4
我使用
![](/icons/11739de.gif)
After examening processRequests
![](/icons/11739kh.gif)
![](/icons/11739class.gif)
![](/icons/11739return.gif)
If getRequestMode
![](/icons/11739return.gif)
In my
![](/icons/11739case.gif)
Zend::register("post",
![](/icons/11739new.gif)
Zend::register("get",
![](/icons/11739new.gif)
The $_POST and $_GET
![](/icons/11739set.gif)
So $_POST["xajax"] will never get to processRequests of the xajax
![](/icons/11739class.gif)
You can resolve this by changing the two lines to the following two lines:
Zend::register("post",
![](/icons/11739new.gif)
Zend::register("get",
![](/icons/11739new.gif)
In this way the $_POST and $_GET
![](/icons/11739int.gif)
CtC
Administrator
From: Ohio, USA
Registered: 2006-07-14
Posts: 1331
Website
Thanks for the post! I've added this to the tips and tricks section of the wiki.
// Joe
最新评论