Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
628 views
in Q2A Core by

After choosing another theme and using the latest v1.7.4 all my ajax requests did not work anymore and I got:

Unexpected response from server - please try again or switch off Javascript

 I checked the theme file and found the error:

        function initialize()
        {
            // change navigation: bring "ask" to front
               $hash = $this->content['navigation']['main'];
               $hash = array('ask' => $hash['ask']) + $hash;
               $this->content['navigation']['main'] = $hash;

Looking into the php files in the ajax folder, e.g. ajax/vote.php you see the call:

$themeclass->initialize();

So I guess this is the culprit causing the problem. Maybe the $content is not set when the ajax call takes place?

I fixed it by:

           $hash = $this->content['navigation']['main'];
            if(isset($hash))
            {

                $hash = array('ask' => $hash['ask']) + $hash;
                $this->content['navigation']['main'] = $hash;
            }

Hope that helps.

Q2A version: 1.7.4
by
Which theme does this happen in?
by
One of my own custom themes. Not public.

Please log in or register to answer this question.

...