我在CSDN和 xajaxproject.org 以及百度都发帖了,还没人回复,郁闷中。。。,逛去逛来就进到火狐社区来了。希望有人帮忙解决
我直接用xajaxproject.org 的示例测试的:
<?
include_once ("xajax555/xajax_core/xajax.inc.php");
session_start();
$xajax = new xajax();
$xajax->registerFunction("sayhello");
function sayhello($arg){
$res = new xajaxResponse();
$res->assign("SomeElementId", "innerHTML", $arg);
return $res;
}
$xajax->processRequest();
?>
<html>
<head>
<?
$xajax->printJavascript("xajax555/");
?>
</head>
<body>
<div id="SomeElementId"></div>
<button>Click Me</button>
</body>
</html>
然后生成的页面:
<html>
<head>
<script type="text/javascript" charset="UTF-8">
/* <![CDATA[ */
try { if (undefined == xajax.config) xajax.config = {}; } catch (e) { xajax = {}; xajax.config = {}; };
xajax.config.requestURI = "http://www.freeeden.info/meme.php";
xajax.config.statusMessages = false;
xajax.config.waitCursor = true;
xajax.config.version = "xajax 0.5 rc2";
xajax.config.legacy = false;
xajax.config.defaultMode = "asynchronous";
xajax.config.defaultMethod = "POST";
/* ]]> */
</script>
<script type="text/javascript" src="[url=view-source:http://www.freeeden.info/xajax555/xajax_js/xajax_core.js]xajax555/xajax_js/xajax_core.js[/url]" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8">
/* <![CDATA[ */
window.setTimeout(
function() {
var scriptExists = false;
try { if (xajax.isLoaded) scriptExists = true; }
catch (e) {}
if (!scriptExists) {
alert("Error: the xajax Javascript component could not be included. Perhaps the URL is incorrect?\nURL: xajax555/xajax_js/xajax_core.js");
}
}, 2000);
/* ]]> */
</script>
<script type='text/javascript' charset='UTF-8'>
/* <![CDATA[ */
xajax_sayhello = function() { return xajax.request( { xjxfun: 'sayhello' }, { parameters: arguments } ); };
/* ]]> */
</script>
</head>
<body>
<div id="SomeElementId"></div>
<button onclick="xajax_sayhello('It worked!');">Click Me</button>
Error: the xajax Javascript component could not be included. Perhaps the URL is incorrect?\nURL: xajax555/xajax_js/xajax_core.js");
还说十分钟学会。折腾我几天了。。。先谢谢了! |