Topic: Content-Type not recognized automatically

Hi guys,

I'm totally stuck. On my Windows Apache the following code works perfect:

     $html = $tpl->fetch("modules/home/diary_entries.tpl");   
     $objResponse->assign("diary_entries","innerHTML",$html);   
     return $objResponse;

In Firebug it is correctly recognized as application/json type. The text in the div gets refreshed and no error in the debug console.

However on my Mac (Unix Xampp), the exact same code does not work:
ERROR: No response processor is available to process the response from the server. Content-Type: text/html; charset=utf-8

How can I tell xajax to use the right content-type !?

(The only other minor difference between the two systems is that on my WIndows PC I run php5.3.1, on Mac I run php5.4; but I don't think that is the reason)

Thanks in advance!

Re: Content-Type not recognized automatically

Hi,

xajax 0.6 works with php 5.4 but xajax 0.5 does not.

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

Re: Content-Type not recognized automatically

Yes, I use xajax 0.6

Re: Content-Type not recognized automatically

Sorry, but are you saying you are using 0.6 or will try it?

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

Re: Content-Type not recognized automatically

I use 0.6

Re: Content-Type not recognized automatically

Well maybe you ned to post the php and html code...

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

Re: Content-Type not recognized automatically

I work with smarty as template engine

Initiate XAJAX in config.php

       require('lib/xajax/xajax_core/xajax.inc.php');
   
       $xajax = new xajax();
       $xajax->configure('debug', true);
       $xajax->configure('javascript URI', ROOT_DIR.'lib/xajax/');
       //$xajax->configure('defaultMode', "asynchronous");
           $xajax->configure('allowAllResponseTypes', true);
           $xajax->register(XAJAX_FUNCTION, "insertdata");       
           require_once('lib/functions/insertdata.php');
   

Call asynchronous Post:    <a href="#" onclick="xajax_insertdata('{$tbl_diary}', xajax.getFormValues('insert'));return false;" class="btn"><span>Post<span></a>

insertdata.php:

  function insertdata( $table, $data ) {
 
     //global $tpl;
     global $memcache;
     global $l;
     global $tpl;
     global $user_data;
          
     $objResponse = new xajaxResponse(); 
   
     //include('settings/template.php');   
     include('settings/tables.php');   

     if ($table == $tbl_diary) {
     
           $mysqldate = date( 'Y-m-d H:i:s', time() );
                     
             $diary_note = mysql_real_escape_string($data['note']);
   
           $diary = new ModifyEntry();
           $diary->table  = $table;
           $diary->cols   = 'userID, entry, date';
           $diary->values = " '".$user_data['ID']."', '".$diary_note."', '".$mysqldate."' ";
   
           $diary->insert(); 
           unset($diary);
                   
           include("lib/functions/fetch_diary.php"); // retrieve updated array of entries
           $tpl->assign('ay_diary', $ay_diary);
                     
           $html = $tpl->fetch("modules/home/diary_entries.tpl");   
           $objResponse->assign("diary_entries","innerHTML",$html);   

           return $objResponse; 
                
     }


Debug Output:

Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
DONE [52ms]
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
ERROR: No response processor is available to process the response from the server.
Content-Type: text/html; charset=utf-8
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
RECEIVED [status: 200, size: 0 bytes, time: 50ms]:
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
SENT [143 bytes]
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
SENDING REQUEST
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
CALLING:
xjxfun: insertdata
URI:
http://localhost/happify/
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
POST: xjxfun=insertdata
&xjxr=1360251719374
&xjxargs[]=Sdiary
&xjxargs[]={"note":"bla bla bla"}
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
INITIALIZING REQUEST OBJECT
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
PREPARING REQUEST
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
PROCESSING PARAMETERS [2]
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
INITIALIZING REQUEST
Thu Feb 07 2013 16:41:59 GMT+0100 (CET)
STARTING XAJAX REQUEST