2

I'm having a problem trying to get working those 2 plugins together: Localisation (for translating the javascript) and facebox (everyone knows that one right?)

I can make them work separately without any problem, but when the localisation plugin is loaded and I clic on a link that launches a facebox modal, the ajax request start, the facebox modal window shows up (with the loading gif) and directly the request is aborted (URL turns red and the word "aborted" appears, in firebug)

In firefox's error consol it says: "setting a property that has only a getter" and points to the file: jquery-1.4.min.js, line 126 (I've checked, and it gives the same error with jquery 1.3.2)

And here is my code:

$(document).ready(function() {
    $.localise('idioma', {language: AmigoPoints.lang, path: AmigoPoints.baseHref + '/public/js/jquery/'});
    //añadir /format/html/ a los href para que sea AJAX para ZF
    $('a[rel*=facebox]').each(function() {
        this.href += '/format/html';
    })
    // inicializa el plug-in que lanza nuevos links en ventanas modales
    jQuery('a[rel*=facebox]').facebox();
})

Since the error is in the jquery file, I don't know where to look to try to solve this issue: I suppose that the error is in my code, but I can't see it. Any thougts anyone?

OSdave
  • 8,538
  • 7
  • 45
  • 60
  • Just a hint - get original, not minified version of jQuery and check what part of your script calls the failing jQuery part - mostly this problems are *not* in jquery, but in the way you use jquery's functions. – Adam Kiss Feb 27 '10 at 13:45
  • i totally agree: i'm sure that the problem is in my code, not in jquery's. I've tried your hint, the line which throws the error is nº 5252: firebug shows me this line: for ( var j = 0; j < eventType.length; j++ ) { but if I open the jquery-1.4.2.js in my IDE and go to line 5252 i see: xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null ); anyway, does 1 of these lines gives you a hint about where I'm doing wrong? – OSdave Feb 27 '10 at 14:11
  • Try wrapping sections of your code in "try/catch" blocks, if you can't figure out where your code is failing via the Firebug stack trace. – Pointy Feb 27 '10 at 14:55

1 Answers1

0

well, i found a "solution". Instead of using the localisation plugin I load the language file acording to the user's language preference directly in my web page. I think the problem comes from the fact that the plugin loads the language file with an ajax request, and as it is a file (as oposed at a normal request) jquery has trouble to perform a normal AJAX request after that. Maybe there is a way to avoid this behaviour, if anyone knows please tell me. Anyway, I know have my javascript translated and the facebox plugin working, so I'm happy. Thanks to Adam and Pointy for their advices. see you

OSdave
  • 8,538
  • 7
  • 45
  • 60