admin_url('admin-ajax.php'))); } add_action('wp_enqueue_scripts', 'load_crypto_js'); // Ajax Action Hook for fetching data add_action('wp_ajax_fetch_crypto_data', 'fetch_crypto_data'); add_action('wp_ajax_nopriv_fetch_crypto_data', 'fetch_crypto_data'); function fetch_crypto_data() { // Fetch data from the API and return it // Assume we're using a GET request to a fictional API endpoint $api_url = 'https://api.example.com/top10crypto'; $response = wp_remote_get($api_url); $body = wp_remote_retrieve_body($response); echo $body; wp_die(); } ?>