I posted this question to answer it because it took me a long time to find a workaround for this safari error. Hope this helps someone.
As a result, I created another ajax request that runs before the actual moodle request. This request uses the wordpress AJAX function to do a CURL for the moodle server. This allows me to get a redirected URL (which includes the moodle user id). Then, after completing the request, I make a real request to the moodle server.
Code example:
// redirect follower ajax request to figure out what the final moodle login url is // this is necessary becuase SAFARI 7.03 looses CORS headers on ajax requests add_action( 'wp_ajax_lms_redirect_follower', 'lms_redirect_follower' ); add_action( 'wp_ajax_nopriv_lms_redirect_follower', 'lms_redirect_follower' ); function lms_redirect_follower(){ $url = 'http://'.get_field('moodle_url', 'options').'/login/index.php'; $username = $_POST['username']; $password = $_POST['password']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,"username=".$username."&password=".$password); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $server_output = curl_exec ($ch); $url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); echo $url; die(); } function moodle_sso () { ?> <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script> function crossDomainPost(user, pass) { // first get the redirect url var moodle_login_url = 'http://<?php the_field('moodle_url', 'options'); ?>/login/index.php'; var data = { 'action': 'lms_redirect_follower', 'username': user, 'password':pass }; $.post("<?php echo admin_url( 'admin-ajax.php' ); ?>", data, function(response) { moodle_login_url = response; $.ajax({ type: 'POST', url: moodle_login_url, cache: false, xhrFields: { withCredentials: true }, crossDomain: true, data: {"username":user, "password":pass}, success: function(responseData, textStatus, jqXHR) { $('#loginform').submit(); }, error: function (responseData, textStatus, errorThrown) { // console.log(errorThrown); // console.log(responseData); }, complete: function(responseData, textStatus, errorThrown){ // console.log(errorThrown); // console.log(responseData); } }); }); } $(document).ready(function(){ $('#wp-submit').click(function(ev){ ev.preventDefault(); return crossDomainPost($('#user_login').val(), $('#user_pass').val()); }) }) </script> <?php } add_action('login_footer', 'moodle_sso');