Site icon Hip-Hop Website Design and Development

Making an ajax request from a different domain

I’m making an ajax request from my primary domain to a subdomain. I’ve solved my cross origin issues so I’m not getting an error. The call is returning data:0. I’ve checked my response config and the ajax url is correct as well as “action”. My functions.php looks like this:

add_action("wp_ajax_sendhire", "sendhire");
add_action("wp_ajax_nopriv_sendhire", "sendhire");

function sendhire() {

    $cars = array("Volvo", "BMW", "Toyota");
    return json_encode($cars);
    die();

}

The data, obviously, is just for testing.