Topic: I have a problem

Hi!, my name is alberto, i learning how to use ajax, i downloaded the ajax 0.5 version and i paste this code in a new page:

<?php
    /*** include the xajax bootstrap ***/
    include 'xajax/xajax_core/xajax.inc.php';

    /*** a new xajax object ***/
    $xajax = new xajax();

    /*** register a PHP function with xajax ***/
    $rqstButton = $xajax->register(XAJAX_FUNCTION, 'showText');

    /*** set the request button parameters ***/
    $rqstButton->setParameter(0, AJAX_JS_VALUE, 0);

    /*** process the request ***/
    $xajax->processRequest();


    function showText()
    {
        /*** the content to assign to the target div ***/
            $content = 'Hello World';

        /*** a new response object ***/
        $objResponse = new xajaxResponse();

        /*** assign the innerHTML attribute to the new $content ***/
        $objResponse->assign("my_div","innerHTML", $content);

        /*** return the object response ***/
        return $objResponse;
    }

    /*** process the request ***/
    $xajax->processRequest();

    /*** the path is relative to the web root mmmk ***/
    $xajax_js = $xajax->getJavascript('/xajax');
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>

<title>PHPRO.ORG</title>
<?php echo $xajax_js; ?>
</head>

<body>
<button type="button" onclick="<?php $rqstButton->printScript(); ?>">Click me</button>
<div id="my_div">New text will happen here</div>
</body>

</html>

this is an example that find in internet but, doesnt work, this are the errors:


( ! ) Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\sai\test\xajax\xajax_core\xajax.inc.php on line 360
Call Stack
#    Time    Memory    Function    Location
1    0.0000    144712    {main}( )    ..\ajax.php:0

( ! ) Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\sai\test\xajax\xajax_core\xajax.inc.php on line 1305
Call Stack
#    Time    Memory    Function    Location
1    0.0000    144712    {main}( )    ..\ajax.php:0

( ! ) Strict standards: Only variables should be assigned by reference in C:\wamp\www\sai\test\xajax\xajax_core\xajaxPluginManager.inc.php on line 286
Call Stack
#    Time    Memory    Function    Location
1    0.0000    144712    {main}( )    ..\ajax.php:0
2    0.0781    732160    xajax->register( )    ..\ajax.php:9
3    0.0781    732608    xajaxPluginManager->register( )    ..\xajax.inc.php:374

( ! ) Strict standards: Only variables should be assigned by reference in C:\wamp\www\sai\test\xajax\xajax_core\xajaxPluginManager.inc.php on line 286
Call Stack
#    Time    Memory    Function    Location
1    0.0000    144712    {main}( )    ..\ajax.php:0
2    0.0781    732160    xajax->register( )    ..\ajax.php:9
3    0.0781    732608    xajaxPluginManager->register( )    ..\xajax.inc.php:374

( ! ) Notice: Use of undefined constant AJAX_JS_VALUE - assumed 'AJAX_JS_VALUE' in C:\wamp\www\sai\test\ajax.php on line 12
Call Stack
#    Time    Memory    Function    Location
1    0.0000    144712    {main}( )    ..\ajax.php:0
Click me ->this is a button
New text will happen here -> this text should be changed for "HELLOW WORD"


I ran the example the wall in the folder /xajax/examples/thewall and i have the same problem

i run wampp with PHP 5.4.16 version

thanks for your help

Re: I have a problem

Hi,

I just noticed your post. I apologize but I as on vacation at that time.

The problem is xajax 0.5 does not run properly on php after version 5.2.

You can fix the problems by editing the specified files and removing the references.

I believe  AJAX_JS_VALUE should be changed to XAJAX_JS_VALUE

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.