Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

SS 3.0 CMS Backend: no content shown, when clicking a menu-link.


Reply

27 Posts   4041 Views

Avatar
Leon223

14 September 2012 at 2:33am Community Member, 10 Posts

We finally found the solution to this problem, our server returned text/json;charset=UTF-8 for JSON responses.

To fix the problem, open /framework/admin/javascript/LeftAndMain.js and replace the following line:

if(xhr.getResponseHeader('Content-Type') == 'text/json') {

With:

if(xhr.getResponseHeader('Content-Type').indexOf('text/json')===0) {

Avatar
vwd

24 October 2012 at 4:13am (Last edited: 24 October 2012 4:36am), Community Member, 159 Posts

Hi Leon223,

Thank you very much for posting the solution - we encountered the same issue of the server returning text/json;charset=UTF-8 for JSON responses. And your patch works.

Just wondering, have you submitted a pull-request for this fix?

I'm surprised more people aren't encountering this issue. Also, the description in [url=http://open.silverstripe.org/ticket/7708]Trac ticket #7708[/url] doesn't quite seem to match up with what I was experiencing... content area wouldn't appear if any link, either on the left hand menu or the site tree were clicked. Would only appear after a full refresh. I guess that makes sense, as a full refresh isn't a JSON request and the issue is related to the JSON response Content-Type.

Thanks again.
VWD.

Avatar
illektr1k

26 October 2012 at 8:55am (Last edited: 26 October 2012 8:55am), Community Member, 6 Posts

I'm still having this issue, latest stable @ 2012-10-26.

The code in /framework/admin/javascript/LeftAndMain.js has been updated to:

382 // If content type is text/json (ignoring charset and other parameters)
383 if(xhr.getResponseHeader('Content-Type').match(/^text\/json[ \t]*;?/i)) {

My server is replying with "Content-Type:text/json" but the TinyMCE content editor doesn't appear. Or it does, but only for a fraction of a second.

Avatar
bod

27 October 2012 at 2:09am Community Member, 72 Posts

Have encountered this bug with my clients hosting environment, was driving us nuts! Thanks Leon223 for the patch which works like a charm. Hope the Silverstripe Dev team take note.

Cheers :o)

Avatar
snel

24 January 2013 at 8:08pm Community Member, 10 Posts

After switching to nginx/php54-fpm configuration and upgrading to the latest silverstripe release (3.0.3) I have found a new problem with in the admin-section of Silverstripe. I think, it is related because the output in the browser is the same as posted some months ago (also see screenshot). Loading the "Products" -Tab admin-section is no problem until clicking within the form and thus firing a xhr request. Using firebug I found that the content-type of the returned data is set to text/html even though the returned content is json encoded. I alreday extended the mime.types of the nginx-configuration but had no luck. reloading the whole page fixes the prolem.

Can anyone tell where and if the content-type of the ajax-response is set within ModelAdmin? Or is there a problem with the nginx configuration? I have made a copy from http://sspaste.com/paste/show/505bf25860775

Avatar
prwodux

26 June 2013 at 9:42pm Community Member, 7 Posts

I am having the same issue in admin side. Screenshot is attached.

Attached Files
Avatar
prwodux

27 June 2013 at 12:42am Community Member, 7 Posts

Solved the issue.
Remove whitespace before an opening tag, or after a closing tag, in one of the project PHP files.(mysite/code/<php files>)

Avatar
monk

7 September 2013 at 2:22am (Last edited: 7 September 2013 2:22am), Community Member, 5 Posts

Dude, I want to marry you. thanks a lot!