Xajax + smarty problems. Xajax + smarty is in a hurry! My refreshContent function cannot be called. I have been troubled by this problem for several days. I just cannot find the problem. I hope you can help me to see it. thank you for the xajax + smarty problem! My refreshContent function cannot be called. I have been troubled by this problem for several days, but I cannot find the problem. I hope you can check it out for me. thank you!
The code is as follows:
Xajax_smarty.php
Require_once ('config/Config. inc. php ');
Require_once ('xajax/xajax_core/xajax. inc. php ');
$ Xajax = new xajax ();
Function loadContent ($ n ){
Global $ Smarty;
If ($ n = 0 ){
$ Data [] = array ('title' => 'helloworld', 'content' =>'
What is going on?
');
$ Data [] = array ('title' => 'another item', 'content' =>'
Nothing fancy
');
}
Else if ($ n = 1 ){
Echo '================ ';
$ Data [] = array ('title' => 'dynamically loaded', 'content' =>'
There you go
');
}
$ Smarty-> assign ('posts', $ data );
$ Ret = $ Smarty-> fetch('post.html ');
$ Smarty-> clear_all_assign ();
Return $ ret;
}
Function refreshContent ($ formValues) {// call failed
Echo "ldkfjdl ";
$ Response = new xajaxResponse ();
$ NewContent = loadContent ($ formValues ['Select _ page']);
$ Response-> addAssign ('content', 'innerhtml ', $ newContent );
Return $ response;
}
$ Xajax-> registerFunction ('refreshcontent ');
$ Xajax-> processRequest ();
$ Smarty-> assign ('content', loadContent (0 ));
$ Smarty-> assign ('xajaxjavascript ', $ xajax-> getJavascript ('xajax /'));
$ Smarty-> display('main.html ');
?>
Post.html
<% {Foreach from = $ posts item = post} %>
<% {$ Post. title} %>
<% {$ Post. content} %>
<% {/Foreach} %>
Main.html
<% {$ Xajaxjavascript} %>
Smarty $ amp; xajax
<% {$ Content }%>
Http://www.bkjia.com/PHPjc/632483.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632483.htmlTechArticlexajax+smarty problem urgent Ah! My refreshContent function cannot be called. I have been troubled by this problem for several days, but I cannot find the problem. I hope you can help me to see it. thank you...