function checkSession(){
$.ajax({url: "session.php", success: function(data){
if( data == 1){
var postFilen = 'msg.php';
$.post(postFilen, function(data){
$("#msg").html(data).find("#message2").fadeIn("slow")
}
} else {
$('#message2').hide();
}
}});
// setInterval('checkSession()',1000);
}
Basically, this is checking if data is 1 in session.php, and if it is, it should run msg.php´s div #message2 in #msg
If you formatted your code more logically it would be clearer what your intentions were with this.
In your $.post() call, you close the curly brace on the function, but you don’t close the $.post() paren.
Replace:
with:
Edit: This is what I mean by properly format: