Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"undefined $" - jQuery errors #1497

Closed
anonymous-matomo-user opened this issue Jul 22, 2010 · 33 comments
Closed

"undefined $" - jQuery errors #1497

anonymous-matomo-user opened this issue Jul 22, 2010 · 33 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. worksforme The issue cannot be reproduced and things work as intended.
Milestone

Comments

@anonymous-matomo-user
Copy link

Hallo ,
i've recently updated from piwik 6.3 .
I've noticed that can be a problem for the index , with jQuery errors on "undefined $" that point to lines where are present options with international characters , for example thai .

The configuration of my webserver is to output as default "UTF-8" encoding , so the Asian, arabin characters are writtend the rights way , but european character like ( german, spanish, portoguese ) was replaced by html encoding "à" and so on .
Very strange for an utf-8 page . In the error log nothing appears , so IMHO the problem is just on client-side . I've tried with :
Firefox : 3.6.6 Ubuntu 10.4
Firefox : 2.0.0 Ubuntu 7.10
Chromium : 5.0.375.99 (51029) Ubuntu 10.04
( sorry i don't use finestral(o)s )

To bypass : Deactivate LanguagesManager, and the reactivate it .

Keywords: jquery,language,missing output,index,sites

@robocoder
Copy link
Contributor

We expect mbstring.func_overload = 0.

Can you check your php.ini or phpinfo(), and tell us if mbstring.func_overload is non-zero?

@robocoder
Copy link
Contributor

Can you check the permissions on the tmp/assets folder (and its contents)? The folder needs to be writeable by the web server user, and obviously be able to read/write/update/delete files in that folder.

(Are merged assets not regenerated when the language is changed?)

@anonymous-matomo-user
Copy link
Author

yes all directories are writable .
i've restored simply disable and reanble the LanguagesManger .
Now it's ok .

(Are merged assets not regenerated when the language is changed?)
i've not changed the language , it happened automaticly after upgrade .
I think is a DB issue , because i've tried also new installation on an upgraded DB .

@mattab
Copy link
Member

mattab commented Jul 22, 2010

(Are merged assets not regenerated when the language is changed?)
I don't think they should be deleted.. should they?

matteocisilino, it is maybe just a problem with a UI string missing encoding. What Piwik language were you using?

were you using SVN version before updating, or simply upgraded from the previous 0.6.3 version?

@anonymous-matomo-user
Copy link
Author

Attachment: empty dashboard with javascript errors
jquery-not-defined.JPG

@anonymous-matomo-user
Copy link
Author

Attachment: same result with LanguagesManager disabled
jquery-not-defined-language-manager-disabled.JPG

@anonymous-matomo-user
Copy link
Author

same error for us, we did an upgrade from 0.5.4 to 0.6.4.

If we logon to the backend as admin-user, the website is rendered, but the dashboard is empty. We get the following javascript errors as outlined in the screenshots.

We already deleted the tmp folder, permissions for tmp/* is 777.
Apache is not configured for UTF-8.
mbstring.func_overload = 0

@mattab
Copy link
Member

mattab commented Jul 22, 2010

can you please send your piwik URL in anonymous here, or send by email login+pwd? I'd like to see the error

@anonymous-matomo-user
Copy link
Author

Sure, where should I sent the login+pwd?

@mattab
Copy link
Member

mattab commented Jul 23, 2010

Hello all,
please send your login + pwd + piwik URL to matt attt piwik.org thanks!

@anonymous-matomo-user
Copy link
Author

Hi there,

I am having the same issue and and I found a temporary solution:
The javascript files were packed in the wrong order.

I edited tmp/assets/<long number>.js and moved the part with the jQuery library to the beginning of the file - before all jQuery plugins. Shift reload in the browser then made the tab contents load.

I'm not sure how the packaging of the js is implemented, however it should ensure the correct order of the js files.

Maybe this helps fixing the bug.

@anonymous-matomo-user
Copy link
Author

In my case , the js is packed in the right way .
/*!

  • jQuery JavaScript Library v1.4.2
    and then
    /*!
  • jQuery UI 1.8.2

I still viewing strange things .
now the dashboard is white , with the ajax response that isn't rendered , but as before the code is ready in the browser.

@mattab
Copy link
Member

mattab commented Jul 23, 2010

(In [2637]) Fixes #1497 Hopefully fixing this one by forcing jquery.js, jquery-ui.js etc. to be first in the list therefore in the generated merged JS.

Please try the patch and report if it works for you. thx!

@mattab
Copy link
Member

mattab commented Jul 23, 2010

(In [2638]) Refs #1497 without the debug code please

@mattab
Copy link
Member

mattab commented Jul 23, 2010

Pleas replace your piwik/core/AssetManager.php file by this new one: https://github.com/piwik/piwik/blob/master/core/AssetManager.php?rev=2638&format=txt and let us know if it fixes the issue as expected.

@mattab
Copy link
Member

mattab commented Jul 23, 2010

Note: please delete tmp/assets/* to force the js to be regenerated.

@anonymous-matomo-user
Copy link
Author

I can confirm that I do not experience the issue anymore after replacing core/AssetManager with your new version with the ensureJsFilesSorted() method. Thanks a lot for the quick fix.

@anonymous-matomo-user
Copy link
Author

I can also confirm that the replaced file fixes the problem. Thanks a lot, awesome.
(using php 5.2.10)

@robocoder
Copy link
Contributor

Does it still work if you replace:

    return array_unique($jsFiles);

with:

    return array_flip(array_flip($jsFiles));

@anonymous-matomo-user
Copy link
Author

In the patched core/AssetManager.php file? In which line? I cant find "return array_unique($jsFiles);"

Thanks

@anonymous-matomo-user
Copy link
Author

@vipsoft Unfortunately it doesn't in my installation. Same Javascript errors (jQuery and $ not defined).

This is what I tried:

        private static function getJsFiles()
        {
                Piwik_PostEvent(self::JS_IMPORT_EVENT, $jsFiles);
                return array_flip(array_flip($jsFiles));
        }

@anonymous-matomo-user
Copy link
Author

It doesn't , i'm using php : PHP 5.2.0-8

@mattab
Copy link
Member

mattab commented Jul 24, 2010

Is there anyone still having issues with this,

  • with the new AssetManager.php file,
  • after deleting tmp/assets/*

anyone still with a JS error?

@robocoder
Copy link
Contributor

Ok. It makes sense that it doesn't work with array_flip ... the order that plugin hooks are called by PostEvent isn't guaranteed to be in a particular order.

@robocoder
Copy link
Contributor

(In [2705]) Fixes #1511, refs #1497 (refactoring); update phpdocs; add unit test

@lippoliv
Copy link

I do have this issue after moving my Piwik to an new VPS.
My luck: the old VPS will be running piwik for one week from now.

So the DB is on the new VPS and is running fine. The Piwik is on the old and the new VPS, but on the new one its not running in this case.

Can anyone give me support, I have made all of the given tipps here ^^

Tanks all,
lippoliv

PS here's the console from overall-dashboard:
Uncaught SyntaxError: Unexpected token < /index.php?module=Proxy&action=getJs&cb=97b6d5efe49e97d4303feb7993750b30

Uncaught ReferenceError: setRowData is not defined index.php?module=MultiSites&action=index&idSite=1&period=day&date=today

Uncaught ReferenceError: prepareRows is not defined index.php?module=MultiSites&action=index&idSite=1&period=day&date=today

Here from single Page
Uncaught SyntaxError: Unexpected token < /index.php?module=Proxy&action=getJs&cb=97b6d5efe49e97d4303feb7993750b30

Uncaught ReferenceError: $ is not defined index.php?module=CoreHome&action=index&idSite=1&period=day&date=today

@lippoliv
Copy link

Sorry for reopening, wasn't as hard as it seems...

Just -as admin- go to "Settings > System Check" and have a look to the output.

In my Case it was the non-binary-upload...

  1. Backed up global.ini.php
  2. Re-Downloaded Piwik
  3. Deleted Piwik from WebSpace
  4. Uploaded the fresh Piwik
  5. Uploaded the (in step 1 back-uped) global.ini.php
  6. Visit Piwik-Instance-URL and have fun :)

@anonymous-matomo-user anonymous-matomo-user added this to the Piwik 0.6.5 milestone Jul 8, 2014
@joshhansen
Copy link

I'm sorry to say this, but I'm having exactly this old problem once again in 2.12.1, after an upgrade from 2.8.3. When loading the Piwik dashboard, I get these errors:

ReferenceError: $ is not defined index.php:68:8
ReferenceError: $ is not defined index.php:753:0
ReferenceError: $ is not defined index.php:778:0

So jQuery seems not to be loading. Moreover, there actually appear to be no network requests on the page except for the initial GET request.

I've attempted forcing tmp/assets to regenerate, but no luck.

@mattab
Copy link
Member

mattab commented Sep 20, 2015

Hi @PabloCastellano please create a new issue with your error message (and screenshot) as this one is closed

@sandeepjain2015
Copy link

Hi @mattab i am getting ReferenceError: $ is not defined

Due to this my dashboard is empty .Please help.
piwik_jquery

@sgiehl
Copy link
Member

sgiehl commented Jun 2, 2016

Maybe your JavaScript can't be loaded. Are there any loading errors (404/500/...)?

@PabloCastellano
Copy link
Contributor

In my case it was the ublock extension (similar to adblock) which was blocking javascripts. Can you check it too @sandeepjain2015?

@mattab
Copy link
Member

mattab commented Jun 3, 2016

when you have ublock extension enabled, do you see a message in red, that asks you to try disable the ad blocker extension? We added this in #10137 so hopefully you can see it

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

8 participants