a-ok Posted October 29, 2014 Share Posted October 29, 2014 Hi folks, I have a bit of an odd question, but I'm assuming it's related to something I have/haven't changed upon moving my local build to a live server. Everything, locally, works 100% and I have encountered no problems at all, but sometimes, when logging into the admin, the stylesheets/js will break and I'll get a broken page (see image below) – sometimes it happens, sometimes not and the page it happens on varies as well. The thing is, once it's happened, I can't return to the unbroken site until I save over the config.php file. Or, after a few refreshes it returns back. Odd, right? Looking in the error console on devtools, it states: Uncaught ReferenceError: $ is not defined sheffieldculture.co.uk.s141188.gridserver.com/:205 Uncaught ReferenceError: initPageEditForm is not defined This makes me think that the jQuery is failing to load... Any thoughts/similar issues? Link to comment Share on other sites More sharing options...
a-ok Posted October 29, 2014 Author Share Posted October 29, 2014 It looks like it's not getting anything in the `<head>` at all... Link to comment Share on other sites More sharing options...
kongondo Posted October 29, 2014 Share Posted October 29, 2014 Does this help? http://stackoverflow.com/questions/2075337/uncaught-referenceerror-is-not-defined Are you loading CSS before or after JavaScript? Link to comment Share on other sites More sharing options...
a-ok Posted October 29, 2014 Author Share Posted October 29, 2014 This is in the admin... so not modified any of this. Front end works with no problems. Works 100% on localhost. Link to comment Share on other sites More sharing options...
kongondo Posted October 29, 2014 Share Posted October 29, 2014 Aah, silly me - didn't read that properly. PW version? Link to comment Share on other sites More sharing options...
a-ok Posted October 29, 2014 Author Share Posted October 29, 2014 The latest... 2.5. So sometimes it loads <head></head> content, sometimes nothing at all, which explains the JS errors... as nothing is there. Link to comment Share on other sites More sharing options...
Ben Posted October 29, 2014 Share Posted October 29, 2014 If you open up your browser's dev tools, and reload with the network panel active, what are the http responses for the missing js/css? Link to comment Share on other sites More sharing options...
a-ok Posted October 29, 2014 Author Share Posted October 29, 2014 So, I just tried it and it worked fine and loaded everything. Then navigated to a few other pages in the admin and BOOM nothing... here's what the Network panel said I'm wondering if it's something to do with my .htaccess or config? Would this affect the admin area randomly? Link to comment Share on other sites More sharing options...
kongondo Posted October 29, 2014 Share Posted October 29, 2014 Could it be this FastCGI issue? https://processwire.com/talk/topic/5388-admin-pages-displaying-with-no-css/ https://processwire.com/talk/topic/4309-no-css-rendering-in-admin/ 2 Link to comment Share on other sites More sharing options...
a-ok Posted October 29, 2014 Author Share Posted October 29, 2014 Ohhh... I am on Media Temple too. I will try this and get back. Many thanks! Link to comment Share on other sites More sharing options...
a-ok Posted October 29, 2014 Author Share Posted October 29, 2014 Changed it for this domain, to normal CGI, not FastCGI and haven't had it happen yet. Gone through most of the site. This might've solved it. I will read up on those forum posts, thanks for sharing. Appreciated! Link to comment Share on other sites More sharing options...
Ben Posted October 29, 2014 Share Posted October 29, 2014 Yeah, the random nature of it can make troubleshooting difficult. It sounds like a configuration issue. Kongondo has the right idea, but if it doesn't pan out you'll need to trap the error status in the network panel. You can do this by leaving the network on and mashing refresh until failure, then clicking that filter icon and filtering to "css". Basic gist.. 500 means webserver isn't configured correctly. 404 missing or misconfigured 403 permissions error Link to comment Share on other sites More sharing options...
hlipperjohn Posted September 1, 2020 Share Posted September 1, 2020 On 10/29/2014 at 8:21 PM, a-ok said: Uncaught ReferenceError: $ is not defined Basically $ is an alias of jQuery() so when you try to call/access it before declaring the function, it will endup throwing this $ is not defined error . This usually indicates that jQuery is not loaded and JavaScript does not recognize the $. Even with $(document).ready , $ is still going to be undefined because jquery hasn't loaded yet. To solve this error: Load the jQuery library at the beginning of all your javascript files/scripts which uses $ or jQuery, so that $ can be identified in scripts . There can be multiple other reasons for this issue: Path to jQuery library you included is not correct The jQuery library file is corrupted Working offline Conflict with Other Libraries Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now