Topic: xajax doesnt work without session

Hello,

probably it's something related with my code, but xajax calls dont work when the session is not started previously. I get an uncaugh object reference in the browser console (xajax_core.js line 395).
If the session is started everything works ok. Am i doing something wrong or xajax needs the session to work?.

The hosting company of the web i am working uses nginx as proxy cache. And they told me that everytime the session cookie exists, the proxy is disabled. And, unfortunatelly i display via xajax a popup for almost of the visitors the first time they access to the site


Thanks a lot,
Daniel

Re: xajax doesnt work without session

Hi,

There is no session requirement in xajax.

The error is occuring in the xajax js on the browser.

Post your code and I'll see if I can spot anything.

Ed

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

Re: xajax doesnt work without session

Hello, thx for answering.

I dont know what code i can show since it is for all the functions. I have noticed that the problem is when i return a xajaxresponse.

This is the message i get in the console:

----------------------------------------------------------------------------------------------------------   
POST http://192.168.1.160/index.php 200 OK 77ms     xajax_core.js (línea 395)
POST http://192.168.1.160/index.php 200 OK 49ms     xajax_core.js (línea 395)
POST http://192.168.1.160/index.php 200 OK 46ms     xajax_core.js (línea 395)
POST http://192.168.1.160/index.php 200 OK 48ms     xajax_core.js (línea 395)
POST http://192.168.1.160/index.php 200 OK 49ms     xajax_core.js (línea 395)
uncaught exception: [object Object]
-----------------------------------------------------------------------------------------------------------

so, it makes 5 post calls, when i look inside one of them:
--------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?><xjx><cmd cmd="as" id="lytebox" prop="innerHTML"><![CDATA[S<div>
    <div id="lytebox_coverpage" onclick="$('lytebox').style.display=''">
    </div>
    <div id="lytebox_general_container">
        <div id="lytebox_container_up">
            <div id="lytebox_close" onclick="$('lytebox').style.display=''">
            <img src="/images/fermer.gif"/></div>
        </div>
        <div id="lytebox_container">
            <span></span>            <div>
                <div id="message"> n'est pas une adresse valide</div>            </div>
        </div>
        <div id="lytebox_container_down"></div>
    </div>
</div>]]></cmd><cmd cmd="as" id="lytebox" prop="style.display">Sblock</cmd><cmd cmd="js">SjQuery('html,body').animate({scrollTop:'0px'}, 500);</cmd></xjx>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Which is exactly the right response, is it strange no?. And if the session is created, only one post call is made and the answer (a popup in this case) is shown properly in the screen (without session nothing is shown of course)

Re: xajax doesnt work without session

That looks like a good response.

Please post the php code...

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

5 (edited by yauros 2012-10-18 10:47:38 AM)

Re: xajax doesnt work without session

Hello, thx again and sorry for making you to waste time.

i am idiot definitely, i was making an echo to write on screen when the session is not started.... and you can imagine that echo was at the beginning of the ajax response.... and even watching it, i didnt think it could be the reason smile

Re: xajax doesnt work without session

Stuff happens!

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

Re: xajax doesnt work without session

yauros wrote:

Hello, thx again and sorry for making you to waste time.

i am idiot definitely, i was making an echo to write on screen when the session is not started.... and you can imagine that echo was at the beginning of the ajax response.... and even watching it, i didnt think it could be the reason smile

hello..what do you mean by "making an echo to write"? I got the same error on line 395 at xajax_core.js . I don't know what to do..anybody can help me?

Re: xajax doesnt work without session

If you use echo or print within an xajax registered function - while the browser is waiting for an xajax response - the browser side xajax thinks it has received an invalid response - which it has.

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

Re: xajax doesnt work without session

so actually there is nothing wrong with xajax_core.js on line 395?

Re: xajax doesnt work without session

Guess not.

I tried putting an echo statement in one of my pages and the resulting error is in xajax.js at line 395.

Turning on the xajax debugger it complains that there is no response processor available on account of bad data.

Also make certain that there are no leading or trailing characters in your code...

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

11 (edited by yauros 2013-07-07 8:49:21 AM)

Re: xajax doesnt work without session

Hello, yes the format of the response is invalid adding a random string... the funny part is that i was making tests and that string was in the top part with a font like 30pt size!!!!!!