header('Access-Control-Allow-Origin: *');
You only need that one in the top of your PHP file.
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
Remove these.
Remove all the request header stuff in your events.
Also, try setting a text object's text with the Ajax.LastData instead and remove the check if not 0.