As you’re making a synchronous request, that should be
function getRemote() { return $.ajax({ type: "GET", url: remote_url, async: false }).responseText; }
Example – http://api.jquery.com/jQuery.ajax/#example-3
PLEASE NOTE: Setting async property to false is deprecated and in the process of being removed (link). Many browsers including Firefox and Chrome have already started to print a warning in the console if you use this:
Chrome:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check https://xhr.spec.whatwg.org/.
Firefox:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/
Related Posts:
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- jQuery’s .on() method combined with the submit event
- How to link WordPress heartbeat to ajax form
- AJAX Implementation
- Drag and drop multiple file upload using Ajax WordPress
- How to securely add an Ajax button to a WP Admin page?
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- admin-ajax.php HTTP400: BAD REQUEST – The request could not be processed by the server due to invalid syntax
- WordPress AJAX Call Not Return Result
- How to add WP API and JS featured image attachment
- jQuery Ajax passing empty parameters to my function?
- WordPress Admin AJAX Serialize
- Ajax Modal Flickers When Opened Multiple Times
- splitting the URL using jQuery
- How would you update a frontend form with AJAX
- Why is on status span no search results?
- How to handle 400 status in Ajax [duplicate]
- Refresh Markercluster after ajax call
- AJAX request randomly stop working and returns error 400
- Bad request 400 from custom ajax call
- All AJAX requests return a 400 error
- How to pass parameters from jQuery ajax into PHP function?
- WordPress Heartbeat API cannot parse data
- I can’t get a return value from Ajax
- WordPress AJAX return 0 – My case
- merge wp rest api query to get posts per category does not work
- WP AJAX post filter > do something with empty value
- 403 error When i send ajax request on WordPress website
- AJAX jQuery post frontend returning failed to load resource status 400
- Load more posts in the same category – Ajax + Timber
- How to jQuery Ajax show new data from successful insert?
- wp_mail doesn’t work when logged in?
- Problems with wordpress nonces in Ajax call
- Ajax call in WordPress – unable to display the data on the page
- Get post content and show it in a div
- Output multi-steps form results in same page
- Full Front End, AJAX comment system and comment reply script
- How to display contact form 7 form in vanilla js without jquery in frontend
- Ajax Favorite from foreach (how to specify which result result is processed)
- Display full WordPress post under search form using AJAX
- WordPress Select Option Load Custom Fields
- Uncaught TypeError: Cannot read properties of undefined (reading ‘message’) [closed]
- Fetch value using AJAX in WordPress
- Query data after an Ajax insert
- AJAX not working when clicking load more button, when two terms are present in tax_query
- Search live Ajax
- javascript onClick update user_meta from jquery.ajax
- WordPress POST AJAX call, var_dump($_POST) NULL and AJAX response empty when inside ob_start
- jQuery.post returns 0
- Opening Modal popup on Ajax form submission
- Ajax sometimes work and sometimes just don’t work
- My function containing a mysql query launched by ajax is not working in wordpress. What am I missing?
- jQuery ajax method does not return data
- JS global variable doesn’t update
- 400 Bad Request getting on AJAX Call
- jQuery AJAX url wit variable
- React to AJAX adding to the page
- Updating Jquery object with newly created elements after AJAX call
- How to pass array from jQuery to PHP with AJAX in WordPress?
- Download doccument on server rather than clients browser
- AJAX POST Value not being returned – WordPress – AutoTrader API
- Javascript output now showing in custom widget
- Ajax call not working anymore
- Can’t get next post info with ajax
- How to inject data content from external json into a modal, using UIkit?
- Ajax by worpdress affects called jquery inside template file
- WordPress sound bell when new data will add
- Can’t access data from database using AJAX
- WordPress Ajax send response on every iteration of a loop
- Custom WP rest api endpoint only working on non https?
- Bad Request 400… jQuery ajax post of json data to wordpress admin-ajax.php
- How to update my jquery/PHP function to add/remove user as favorites in (WordPress) users list
- AJAX call not initializing for non-admins in WordPress
- What does on() in JavaScript do?
- Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
- How can I fetch loop of post titles via AJAX?
- Ajax request returning full page code
- how to use ajax in plugin admin area?
- jQuery UI Autocomplete showing all results
- Ajaxing in functions.php
- Refine/Filter WP_Query Posts with jQuery or Ajax
- How to speed up admin-ajax.php in wordpress
- WordPress Ajax problem with undefined url
- Ajax image upload with media_handle_upload and form.js
- Ajax loading duplicate post
- Intergrating agile carousel to wordpress: how to write the ajax_callback function
- Ajax post returning full html page as response
- Can’t get done anything with admin.php response
- Is it secure to use admin-ajax.php in front?
- delete post meta by AJAX
- Pull GetOption() variable into jQuery dynamically created html
- Why i can’t get custom fields value or post ID via Ajax?
- Ajax request sends url rather than data
- Merge PDF files from post custom fields(ACF) into one PDF file and respond back the created PDF file, WordPress(AJAX Request)
- How to prevent multiple post with same meta value being created simultaneously in WordPress (with ajax)
- Can’t GET Variable from AJAX URL
- How to update cart total after AJAX success
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- At what stage does wp_ajax hooks gets applied during WordPress request?