Ajax request failed (on start up)

Bug #776801 reported by Nicolaus Sommer
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
chive
Fix Released
High
David Roth

Bug Description

I get the msg "Ajax request failed" right after login. Setting debug on doesn't provide more info. Checked all PHP & mySQL requirements.

Related branches

Revision history for this message
David Roth (davrot) wrote :

Could you please attach the error output?
You get this by clicking on the white icon in the ajax notification box.
thanks.

Changed in chive:
status: New → Incomplete
Revision history for this message
Nicolaus Sommer (nicolaus-sommer) wrote :

Forget it, I have already deleted chive from my server

Revision history for this message
voidf.0xb3 (voidf-0xb3) wrote :

I've been experiencing a similar bug for ages. This could be the same one, so I guess I'll just post here. The "error output", as you call it, is:

["information_schema","mysql","pf"]

That seems to be a JS array of the names of all databases.

Revision history for this message
David Roth (davrot) wrote :

Strange. So you got an "Ajax-Request" failed notification and the only text in the notification area was the array ("information_schema","mysql","pf"]) ?

Revision history for this message
voidf.0xb3 (voidf-0xb3) wrote :

I suppose yes.

Revision history for this message
voidf.0xb3 (voidf-0xb3) wrote :

Without observing any activity here, I decided to investigate this bug myself. I found out that it happens because jQuery expects the AJAX response to be XML and fails to parse it as XML. I tried fixing this by adding an appropriate argument to the relevant $.post() call; that is, I changed line 77 in js/sideBar.js to

  }, "text");

Which fixed this particular error. However, those errors keep appearing all around, probably because of similar things in other requests.

I suppose this should be helpful.

Revision history for this message
voidf.0xb3 (voidf-0xb3) wrote :

Some more investigation completely solved the problem.

In fact, the AJAX request didn't specify what the response should be treated as, so jQuery inferred that from the response's Content-Type: header.

I assume that the Content-Type: header wasn't sent anywhere by the server-side script for that response, so the default one was sent by PHP.

Which, on my server, is application/xhtml+xml.

So, I guess, either the explicit "text" argument should be sent for every request, or an explicit Content-Type: header should be sent for every AJAX response.

Revision history for this message
David Roth (davrot) wrote :

Thank you for your investigation, this is an important piece of information :)
The default data-type behaviour of jquery.post is "Intelligent Guess". It is really strange that you get this error and I'm not able to reproduce this issue in any browser.

Do you use firefox or have firefox installed?
Could you please run chive with the firebug-extension enabled and provide the following infos:

 - Does firebug show any javascript errors?

- In Firebug`s "Net" Tab, look for the request which goes to "http://YOUR_SERVER/chive/trunk/schemata" and post the Response-Headers and the Response Tab content. I have attached a screen-shot so that you can see how it looks on my machine.

Revision history for this message
David Roth (davrot) wrote :

This is the screenshot which shows the schemata request in firebug.

Revision history for this message
David Roth (davrot) wrote :

Excellent work - now everything makes absolute sense.
I'll target this for the 0.4.2 release.

Thank your very much for helping to track this down!

Changed in chive:
assignee: nobody → David Roth (davrot)
importance: Undecided → High
milestone: none → 0.4.2
status: Incomplete → Confirmed
Revision history for this message
voidf.0xb3 (voidf-0xb3) wrote :

Here's the screenshot. As you can see, on my server the default Content-Type: is application/xhtml+xml.

It can easily be fixed by creating a .htaccess file with php_value default_mimetype "text/html", but it's quite ugly.

Revision history for this message
David Roth (davrot) wrote :

You are right, that would be ugly. I'll send the appropriate headers in chive.

David Roth (davrot)
Changed in chive:
status: Confirmed → In Progress
Revision history for this message
David Roth (davrot) wrote :

The bug is fixed in trunk now. All Json-Responses from chive will now send a json response header.
Please report if you encounter any problems.

Changed in chive:
status: In Progress → Fix Committed
David Roth (davrot)
Changed in chive:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.