Welcome Guest, Not a member yet? Register   Sign In
Xajax Whitespace error?
#1

[eluser]acoldone[/eluser]
I've been having trouble getting xajax to work with codeigniter. I set up a simple test


Code:
<?php
class TestXajax extends Controller {

    function TestXajax()
    {
        parent::Controller();    
        $this->load->library('Xajax_lib');
        $this->xajax = new xajax();
        $this->xajax->configure('debug', true);
        
        $this->xajax->registerFunction(array("process_form_data", &$this, "process_form_data"));
        
    
  
          $this->xajax->processRequest();
  
    
        
    }
    
    function index()
    {
        $this->load->view('testview','');
    }
    

    
    function process_form_data($someVar)
    {
        $objResponse = new xajaxResponse();
        
        $objResponse->assign("testDiv", "innerHTML", $someVar);
        
        return $objResponse;
        
        
    }
}
?>
view
Code:
<html>
<head>
<title>TESTING</title>
<?=isset($this->xajax)?$this->xajax->printJavascript($this->config->item('base_url').'assets/scripts'):""; ?>
</head>
<body>
<div id="testDiv"></div>
&lt;INPUT TYPE="button"  value="Test" onclick="xajax_process_form_data('this is a test');return false;"&gt;
&lt;/body&gt;
&lt;/html&gt;


I'm not sure if this is an encoding problem or what. I am testing on a windows machine with apache. I looked for whitespace in the files but couldn't find any. Here is the first part of my xajax debug output:

Code:
Mon Sep 24 2007 17:52:56 GMT-0700 (Pacific Daylight Time)

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

Mon Sep 24 2007 17:52:56 GMT-0700 (Pacific Daylight Time)

RECEIVED [status: 200, size: 112 bytes, time: 110ms]:
[1 space here]&lt;?xml version="1.0" encoding="utf-8" ?&gt;
<xjx>
<cmd n="as" t="testDiv" p="innerHTML">this is a test</cmd>
</xjx>

Here is the javascript error generated in FF:

Code:
Error: xml declaration not at start of external entity
Source File: http://www.wctesting.com/_admin/index.php/testXajax
Line: 1, Column: 2
Source Code:
&lt;?xml version="1.0" encoding="utf-8" ?&gt;<xjx><cmd n="as" t="testDiv" p="innerHTML">this is a test</cmd></xjx>-^

There is one space before the &lt;?xml version="1.0" encoding="utf-8" ?&gt; in the xajax debug output (doesn't show up here). Should apache be set to a utf-8 character set? Do all my files have to set to utf-8? I tried changing apache to utf-8 and saving these two files in the same format and it didn't seem to make a difference. Is there any way of stripping out the spaces using a setting in xajax or php itself? Thanks for any help. This has been driving me bonkers.


Messages In This Thread
Xajax Whitespace error? - by El Forum - 09-24-2007, 07:02 PM
Xajax Whitespace error? - by El Forum - 09-24-2007, 07:18 PM
Xajax Whitespace error? - by El Forum - 09-24-2007, 07:39 PM
Xajax Whitespace error? - by El Forum - 09-24-2007, 11:28 PM
Xajax Whitespace error? - by El Forum - 09-25-2007, 07:28 AM
Xajax Whitespace error? - by El Forum - 09-25-2007, 08:19 AM
Xajax Whitespace error? - by El Forum - 09-25-2007, 10:24 AM
Xajax Whitespace error? - by El Forum - 09-25-2007, 11:21 AM
Xajax Whitespace error? - by El Forum - 09-25-2007, 12:17 PM
Xajax Whitespace error? - by El Forum - 10-16-2007, 01:22 AM
Xajax Whitespace error? - by El Forum - 02-06-2009, 03:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB