"console not defined" from within jquery ajax calls FF3.0 FB1.2b6

35 views
Skip to first unread message

asozzi

unread,
Jul 15, 2008, 6:27:38 PM7/15/08
to Firebug
I just encountered a rather weird problem. The firebug console is not
found when you call it from within a jQuery AJAX call. (FF3.0 FB1.2b6)

i.e
function($) {
$.fn.jqSmug = function(options){
console.log(this);
$.getJSON(URL+"&JSONCallback=?",
function(data){
$.fn.jqFunction.withSessionID(elements);
console.log(this);
}
);
return this;
};
};

I call the function "withSessionID" from within the AJAX call so I am
certain to have the asynchronously requestion SessionID before making
a data call.
The first console.log(this) works without a glitch.
The second console.log(this) does not work and produces the error.
Anywhere within the "withSessionID" function the console is not
accessible (figures as this is within the AJAX call).

I tested FF2.0.0.15 with FB 1.0.5 and there are NO problems there,
logging works.

John J Barton

unread,
Jul 15, 2008, 6:41:06 PM7/15/08
to Firebug
The global scope in the ajax call must be somehow different. You can
try to call loadFirebugConsole() before you use console.log() see if
that makes any differenence.

asozzi

unread,
Jul 15, 2008, 6:59:03 PM7/15/08
to Firebug
So I added the loadFirebugConsole(); statement like so:

function($) {
$.fn.jqSmug = function(options){
console.log(this);
$.getJSON(URL+"&JSONCallback=?",
function(data){

$.fn.jqPlugin.withSessionID(elements);
loadFirebugConsole()
console.log(this);
}
);
return this;
};
};

Same negative result. Then I tried the following:
function($) {
$.fn.jqSmug = function(options){
console.log(this);
$.getJSON(URL+"&JSONCallback=?",
function(data){
loadFirebugConsole()

$.fn.jqPlugin.withSessionID(elements);
console.log(this);
}
);
return this;
};
};

And everything works as advertised, or at least as before. So somehow
calling the public jQuery plugin function from within the AJAX call
does something weird with the scope...
It is beyond my means to find out more, but it does seem to work...

Thanks

jb2386

unread,
Jul 15, 2008, 10:05:23 PM7/15/08
to Firebug
I'm having the same problem and its only come up today after installed
FB1.2b6

I'm using jquery, this is the code I'm trying to use:

$(document).bind('keydown', function(e) { console.log('blah'); });

I get "console not defined".

If I use John's suggestion:

$(document).bind('keydown', function(e) { loadFirebugConsole() ;
console.log('blah'); });

I just get:

loadFirebugConsole is not defined
Reply all
Reply to author
Forward
0 new messages