I would break this problem in to 2 parts.
First, you could sent an Ajax request to your server, sending only the dataString variable.
Then, you can use either cURL or wp_remote_get() on the server to access the real API.
This could be the only solution, if you want to avoid playing hide and seek with hashes and writing tons of code just to make it hard for the users to find the API key.
Related Posts:
- wp_remote_get() to get AJAX url /wp-admin/admin-ajax.php
- Is there a JavaScript API? How to access public and private data in JS?
- Ajax form submission from admin panel
- AJAX request from Chrome Extension to WordPress Website
- How to securely add an Ajax button to a WP Admin page?
- fetching via fetch/ajax gutenberg block data from third party
- AJAX requests broken due to HTTPS for wp-admin
- wp-admin AJAX with Fetch API is done without user
- wp_localize_script escaping my url – fix or alternative
- Most performant way of fetching remote API data?
- How to add WP API and JS featured image attachment
- Implementing an AJAX POST API call in wordpress
- I have to post data by AJAX in wordpress to another Website
- WP Admin AJAX Security – using POST to include a relative URL
- WordPress Ajax Not Working ( Custom Admin page)
- Why a strange discrepency between get_current_user_id() when using AJAX versus output of document.cookie?
- Pass additional parameter with async upload
- Exposing data using a custom WordPress API
- Preprocess submitted data
- How can I call an api before user login
- How to check nonce lifetime value of plugins?
- Use AJAX in a WordPress Plugin to Get Data From Custom Database?
- admin-ajax.php returns 0 even when the post status code is 200 OK
- Can I use application/json content type in WordPress
- wordpress admin ajax trash_comment
- Ajax call not working anymore
- WorddPress website admin part not working correctly – I think ajax/json issue
- How modify comments metabox on post edit screen in WordPress?
- Weird admin-ajax.php problem
- WordPress Get Header and Footer using in Admin Area
- get_comments() returns empty array if called through AJAX
- WordPress blocking polling request when signed into Admin
- randomly get 400 error while user is logged in wp_ajax
- How to submit a button automatically after every scheduled hours?
- Blocking admin-ajax.php from outside domain
- wp-admin/admin-ajax.php 400 Bad request (chrome console)
- contact form 7 form not working in admin panel
- How does the security of admin_ajax.php work?
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- JavaScript implementation of Gzip
- WordPress AJAX with Axios
- Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
- Nonces and Cache
- REST API endpoint for elasticpress autosuggest
- Using ajax on categories and wordpress loops
- How to modify wp_ajax function?
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- Can’t seem to get wp_localize_script to work
- Ajax – gettext without a plugin
- Ajax stops working when logged in?
- WordPress ajax get content post id
- Using wp_handle_upload and media_handle_sideload with ajax
- Create Page With wp_insert_post() and AJAX
- Get wp_title wp ajax
- Ajax custom search not functioning as expected
- Jetpack Infinite Scroll – Add more than 7 posts each time?
- Speed/Performance difference between `wp_ajax` and `init` checks for AJAX/POST requests?
- Remove trailing 0 from function that is used both statically and dynamically
- How to load next and previous posts by Ajax
- Update attachment metadata fails
- Nonce fails on ajax save
- WordPress ajax works on FF but not on IE & chrome
- Disallow second login session
- WordPress P2 live problem
- Ajax Request for both logged and non logged users
- POST Ajax bad request
- Ajax for subscibers not working
- Is it possible to create new user from external form using REST API?
- javascript ajax and nonce
- Chained ajax call, second call returns 0
- How to create a form button that executes a function?
- i’m trying to get all my media query attachments via ajax in wordpress
- Distinguish between 2 instances of admin-ajax.php
- How to update post with Ajax (no plugin)
- Multiple wp_editor instances in custom post type using Ajax
- Including ‘wp-load.php’ after another include() generates an error
- edit user input data contact form 7
- How to keep scripts persistent during admin-ajax process when saving widget?
- Very weird bug: Ajax for non-admins
- jQuery ajax method does not return data
- woocommerce REST api on the website’s front-end
- WordPress 403 error on form submission with Ajax
- I am getting Admin-ajax.php 400 Error
- Ajax and get_template_part
- Download doccument on server rather than clients browser
- How to require files in a custom endpoint
- Load oEmbed iframe within ajax call
- Adding pagination to Ajax Query
- Get post details with pure javascript ajax
- check_admin_referer fails on new AJAX plugin uninstall with “Are you sure you want to do this?”
- Ajax Security regarding user priviliges and nonces
- How to populate data from JSON using AJAX in TypeScript? [closed]
- Use ajax without a plugin?
- Know which script/page is being called by ajax call
- Trying to send AJAX data to WordPress hook
- wp_enqueue_media problem
- Update user meta using Ajax on front end?
- How to use Ajax with WordPress
- Using $.ajax getting 500 error
- admin-ajax.php 400 (Bad Request) what am I doing wrong?