Nevermind, I just figured out that CakePHP had to re-set the cookie because it expired. If you experience the same error, just check the return header with Firebug => "Set-Cookie".
I have a jquery function which calls a CakePHP Function with Ajax and returns it as JSON:
$('#categories a').live('click', function() {
catid = $(this).attr('id');
load_notes(catid);
return false;
});
function load_notes(catid){
$.ajax({
type: 'POST',
url: '/notes/load_notes',
data: 'category_id='+catid,
dataType: 'json',
success: function(data){
jQuery.each(data, function(i) {
new_note = '';
new_note = build_note(this.Note.id, this.Note.content);
new_note.appendTo('#notes').hide().fadeIn(i*300);
//new_note.appendTo('#notes').hide().fadeIn(1000);
//new_note.appendTo('#notes');
});
},
error:function(httpRequest, textStatus, errorThrown) {
alert("status=" + textStatus + ",error=" + errorThrown);
}
});
}
"load_notes" is called after the document is ready and if I click on a Category-Link. This works fine when I just loaded the page or when I click on a category-link after a few minutes. But when I wait for around 30 minutes and fire the function, nothing is returned (therefore the notes can't be displayed). Only if I reload the page, the function works fine again.
I usually get a JSON-Array as a response (checked with Firebug) but when the error occurs, I only get:
"j is null" handleError(a=Object { url="/notes/load_notes", global=true, more...}, b=XMLHttpRequest { onreadystatechange=[xpconnect wrapped nsIDOMEventListener], readyState=4, more...}, d="success", e=null)
Any clue what could cause this? Anyone experienced something similar?
It seems a firebug problem, not jquery. I get this same error with firebug sometimes (fully randomly) and it solves when I restart the browser.
Maybe is a stupid question but.. have you tried with other browsers / consoles?? With Chrome I haven't had this problem again.