1

When using XAJAX I have a call to a function that trims a string. this is a simple function and works just as expected.

Now I want to make this function available to the whole system so I have added it to a helper class as a static method. ever since I moved this function to this class I get a bad response, something like this.


Error: the XML response that was returned from the server is invalid.
Received:



some code here...



You have whitespace in your response.

This message most of the times comes up when there is a fatal error, but nothing shows up in the error log... don't really know what to do from here, any suggestions?

I have included the file, so I know is not an include problem, the static method gets called, but the response that comes back from XAJAX is bad.

Thank you

Onema
  • 7,331
  • 12
  • 66
  • 102
  • what exacly are you "trimming"? the hole xml file or parts of it? – yoda Nov 24 '09 at 18:34
  • is just a name to display on the screen, it trims it if is longer than a user defined length. nothing to do with the actual xml – Onema Nov 24 '09 at 19:50

1 Answers1

0

Your question is ambigious at best. It's pretty easily described by the error your returning ... your currently return an invalid response (i.e. code/non-formatted xml documentation).

Generally, I setup a mail function in a class and include that class into my xajax responses so that I can email myself the response before objectResponse the value.

function xajax_loader($formdata){
global $cms,$debug;
$objResponse = new xajaxResponse();
$dataset = $cms->get_data($cms->_getpage);
$columns = $cms->get_columns($cms->_getpage);
$objResponse->loadXml(search($dataset, $formdata, $columns));
//$debug->phpmailer($dataset,$cms->_getcurrentuser());
return $objResponse;
}

$frw->xajax->registerFunction('xajax_loader');

Also of note: if you are using Mozilla View your Error Console and it will tell you which line you have a failure on. IE8/9 F12 and similar results will be provided in the script debugger.