Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Since I have updated the rate module to 1.4 Ajax does not work any more for voting. That means, that the whole page is reloaded by clicking the rate button. The cause of that problem is, that the rate.js is included before the jquery.js. This leads in Javascript error: ReferenceError: jQuery is not defined @ */sites/all/modules/rate/rate.js?mcndu4:60

What could I do?

I changed line 292 in rate.module from:

drupal_add_js(drupal_get_path('module', 'rate') . '/rate.js', array('scope' => 'footer'));

to

drupal_add_js(drupal_get_path('module', 'rate') . '/rate.js', array('scope' => 'footer', 'group' => JS_DEFAULT,  'weight' => 200));

Just for testing, but did not help. The I commented the line out and added the line

scripts[] = rate.js

to rate.info. Now it works again. I know that this is not a good solution, because now the JS is loaded every time on every page. But I am a bit helpless at that point not having any idea what could be the cause of that strange issue.

An other problem is, that rate widget refuses to work with ajax, if it is loaded via ajax it self.

share|improve this question
    
If you can reproduce the error on another site, I would rather considering to open an issue report for the module. If it is a bug, there isn't much you can do, except reporting it in the issue queue. –  kiamlaluno Nov 3 '12 at 15:44
    
I am not sure whether or not this is a bug of the module or rather a core bug. The strange thing is, that the JS is attached in a wrong order although the module uses Drupal's standard function (drupal_add_js) as recommended. So may be it's a Drupal bug. –  user5950 Nov 3 '12 at 15:51
    
If it is a Drupal bug, you should report it in its issue report. Considering you already found a workaround, I am not sure there is anything else that can be suggested. –  kiamlaluno Nov 3 '12 at 15:55
    
But the workaround is a dirty one and I do no know whether it is an Drupal bug. I am hoping that may be anyone else had have a similar problem and can help me to find the cause. –  user5950 Nov 3 '12 at 15:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.