Post data across WordPress sites

You can use url parameters (read more here http://php.net/manual/en/reserved.variables.get.php) but of course you need to create a small function in jQuery / javascript to retrieves those.

For instance, placing a link like https://www.websiteb.com?country=yourcountry in your Website A and using a get_url_param(country) jQuery function in your Website B, you could pass the value to the AJAX call. I give you a practical example:

Website A

<a href="https://www.websiteb.com?country=yourcountry">Your Country</a>

Website B

$(document).ready(function(){

   var Country = get_url_param("country");

   //Pass your Country value to the AJAX call
   if(Country != null) init_your_ajax_call(Country);

});

function init_your_ajax_call(param){
   //etc etc
}

function get_url_param(name){
        var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);
        if (results==null){
           return null;
        } else {
            if(results[1].indexOf("#")){
                results = results[1].split("#");
                results = results[0];
            } else {
                results = results[1] || 0;
            }
            return results;
        }
    }

This function cleans eventual hashes # from the url and retrieves any parameter value you ask for. Returns null whether the parameter doesn’t exist.