Topic: Template code in response

Hi everyone
I've just started using xajax (0.5 final) under NetBeans (7.1) following your hello world tutorial.
Pushing the inserted button I got an error:

ERROR: ResponseReceived: Invalid response XML: The response contains an unexpected tag or text: {data}.

RECEIVED [status: 200, size: 439 bytes, time: 143ms]:
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->  

<!-- xml version="1.0" encoding="UTF-8" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head><?xml version="1.0" encoding="utf-8" ?>
<xjx>
<cmd cmd="as" id="my_div" prop="innerHTML">SHello World</cmd>
</xjx>

Can anyone tell me how I do get rid the whole template stuff ?

Thanks in advance!

Re: Template code in response

Hi,

Could you post the php code?

Ed

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

Re: Template code in response

As I told. I just took the hello world as a sample - the generated javascript code is in the header at runtime.

<?php
// xajax/xajax_core/xajax.inc.php
require_once("xajax/xajax_core/xajax.inc.php");
$xajax = new xajax();
$xajax->setFlag('debug', true);

/*** register a PHP function with xajax ***/
$xajax->register(XAJAX_FUNCTION, 'showText');
/*** 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>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <form action="#" method="post">
           <button type="button" onclick="xajax_showText();return false;">Click me</button>
           <div id="my_div">New text will happen here</div>
        </form>
    </body>
</html>

Re: Template code in response

I installed NetBeans 7.1 with the PHP pack and greped for 'To change this template, choose Tools |'

It occurs in several .jar files so I guess this is a NEtBeans artifact...

Ed

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

Re: Template code in response

Thank you very much -  you installed NetBeans just to help me out ? WOW!

I'm gonna do some research on the NetBeans side in order to find out what exactly must be changed/disabled in order to make it work... I'll post the exact procedure here.

Cheers

Re: Template code in response

Nope! I searched for hours... it seems to be a bug in the response handling with NetBeans... it automatically adds a header (???)

By the way -  what would you suggest me as IDE to develop under Linux ? Perhaps attested to be running with Xajax on Ubuntu 11.10 ? I don't feel like having much fun struggling around with this bug for much longer since it seems to be NetBeans specific, and I know how painful it is to get some changes for "minor bugs" (seems to be one, no posts on theyr forum concerning this problem).

And thanks again for your help!

Re: Template code in response

I'll play around with NetBeans some more to see what I can come up with.

The xajax response processing is not effected by much of anything that I know of but you never know...

I can't recommend an ide for Linux - I don't use it. I use devphp under Windows.

Ed

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