Do not use synchronous AJAX, switch to asynchronous AJAX instead, and use the `.onload` and `.onerror` events to deal with notifications.