Handle session timeouts when resource requested via AJAX