Refactor onajax handling for windows.