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?
- ASP.NET MVC controller actions that return JSON or partial html
- How to check if I am in admin-ajax.php?
- Ajax in a settings page (update_option is undefined)
- gettext does not translate when called in ajax
- admin-ajax.php vs Custom Page Template for Ajax Requests
- Load tinyMCE / wp_editor() via AJAX [duplicate]
- Admin Media grid view images won’t load
- Is there a hook that fires before an ajax call?
- How to correctly load wordpress in a non WP script for AJAX request
- Why is admin ajax reloading my page
- Plupload in metabox – AJAX action not working in Class
- Why this plugin doesn’t work with media upload page?
- CPU usage: AJAX and Heartbeat API on admin pages
- Solve cors problem using rest api or ajax
- Can part of my WordPress website be headless?
- Nonces, AJAX, script variables & security in WordPress
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- Why would admin-ajax.php redirect to the home page for logged out users?
- Admin Ajax and HTML5 Formdata
- WordPress ajax problem need wordpress expert?
- Ajax WordPress Login needs to be stayed in current page Url without redirecting
- wp_ajax function did not call
- Loading comments in ajax – comment-reply function missing $args
- Woocommerce update product price via AJAX
- How do I query posts by a sub value with the API?
- Popup or admin/update notice on post/page edit screen without page refresh
- Enqueue script in plugin is not working
- WP OAuth Server “The grant type was not specified in the request”
- template_redirect or admin-ajax.php?
- Single page site + pushState?
- Best way to use ajax front-end?
- Ajax solution similar to WP Categories functioning in Admin area
- Ajax calls from the theme directory
- How to pass parameters from jQuery ajax into PHP function?
- merge wp rest api query to get posts per category does not work
- use jQuery.load() to include a php file in a div, wp_query() is part of php file
- Load more posts in the same category – Ajax + Timber
- SOAP Request/Parsing XML From wp_send_json_success
- Redirect after saving form; and yet use wp_die()
- Load more posts (Ajax) in tabbed sidebar on single.php
- Change Post Meta via AJAX from the posts list table
- Ajax requests from front-end with jQuery Fancybox
- Dismiss Admin Pointer Temporarily
- Something strange with ajax
- is there’s a way to get the next page content generated by page break block with ajax call?
- Merge PDF files from post custom fields(ACF) into one PDF file and respond back the created PDF file, WordPress(AJAX Request)
- REST public POST giving 403 forbidden nginx
- Sending email through Ajax without page refresh hangs on admin_ajax.php
- Is there a public ajax endpoint?
- Why Ajax Doesn’t Work?
- How can i do public ajax call?
- How to prevent multiple post with same meta value being created simultaneously in WordPress (with ajax)
- Content including hooks inside wp-settings.php are being called twice in WordPress
- Can’t GET Variable from AJAX URL
- JS global variable doesn’t update
- 404 error custom post type rest api
- How to update cart total after AJAX success
- Jquery wrap permalink in a data-attribute?
- (Frontend AJAX) get post data WITH image thumbnail?
- Load .php file into div using ajax
- Native WordPress Video Shortcode Not Working After Post is Loaded via Ajax
- AJAX Post from same domain to a wordpress page
- Using AJAX for dynamic settings pages
- AJAX admin Internal 500 error Failed to Upload
- Class property not visible inside ajax callback function?
- wordpress ajax bad request 400