As I understand your question, you want to Update a GF field with the results ($distance) of an AJAX request.
If that is correct, on a successful AJAX request, you just need to update the value of your GF field.
Assuming your response
is the actual value correctly formatted. here’s what you need to do.
$.ajax({
type: 'POST',
url: url,
data: {
'action':'example_ajax_request',
'distance' : distance
},
success:function(response) {
// This outputs the result of the ajax request
console.log(response);
$('#your-GF-ID').val( response ); // This is where you update your GF field
},
error: function(errorThrown){
console.log(errorThrown);
}
});
Related Posts:
- Execute Jquery when a specific page in my plugin is loading
- username_exists() function can’t be access without logging in
- Do I require the use of nonce?
- Fatal error: Call to undefined function plugin_dir_path()
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- Dynamic URL to reference custom PHP files
- Can i check if user is doing any ajax request?
- simple wordpress ajax plugin not working when not logged in
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- How to add default images into theme customizer image control?
- Disable External Pingacks on WordPress Posts and Only Allow ‘Self Pings’
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- Validate a users email address when using gmail to register
- Using wp_get_image_editor in a standalone script
- New Plugin Review
- Problem with WordPress Ajax form
- Click loads template via ajax
- How to set a custom path, for ajax image upload folder in admin?
- admin-ajax.php responding with 0
- Making Quote Plugin more efficient
- How to access function from outside of a class within this class in WP plugin?
- Function won’t run onclick using Ajax
- Custom meta box values are not getting saved for my custom post type
- Simple AJAX notification when the new post is added to the database
- how to save checkbox data for custom setting?
- Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”
- Why i can’t get custom fields value or post ID via Ajax?
- Post not populating for custom post type based on category selection
- Call to undefined function error in plugin
- How to get post category list as select in front-end?
- Is there a hack for using is_page() within the function.php file?
- PHP: How to access db the right way in plugin?
- calling admin-ajax.php from admin-ajax.php
- Submit form to db
- AJAX function not working [closed]
- send popup after wp_redirect()
- How to use wp_send_json() and output the value with ajax?
- Disclaimer that will show every refresh of the page
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- Database entry removed on browser refresh, Ajax PHP jQuery
- Is it possible to access admin-ajax.php using PHP?
- Using ACF Relationship field to set post type to draft or published status
- Dynamically populate parameter in Gravity Forms using PHP
- Store ajax data in PHP variable
- Settings API form – submit with AJAX
- How to change basename url for wp-admin?
- Post form – AJAX won’t upload featured image – Plugin development
- How to Send Pingbacks for all Posts in WordPress?
- Reliable way to add nonce to HTTP Header in WordPress?
- Multiple AJAX handler functions conflict in functions.php
- Only the first image uploads
- Add Pre-Defined Value to Click Counter in WordPress
- Illegal string offset checkbox
- Ajax filter with loadmore button
- ssl redirect function is not working
- Custom plugin: how do I call a PHP file if settings option is set to true?
- Gravity Forms: How to add PHP function to confirmation conditional shortcode?
- How to change this ajax function to submit to the default wordpress content area instead of the custom field ‘seller notes’?
- How can i avoid duplicate same post in wp?
- Display a custom name when the user has no name settle in his account
- How can I get my WordPress plugin to receive data and relay it in an ajax/php request to a remote server that requires authentication?
- register_block_type is not working properly
- get_the_author_meta( ‘ID’ ) just return 1
- Submit remote form to wordpress REST API and save data to custom post type
- Update $wpdb query with AJAX
- In a foreach loop, how can I add a meta value if it doesn’t exist?
- Can an AJAX callback function access a PHP variable which was defined during initial page load?
- custom mailchimp form using HTTP API
- How to override theme’s public static function inside of a trait?
- 400 bad request admin-ajax file upload
- Enqueue sripts and styles only if function is called
- post_exists stops working in a scheduled event
- WordPress Ajax filter: Create two loops for different output styles?
- Taxonomy Child Term, Counter is staying on 0
- Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
- Offset with ajax load more posts duplicates
- Input field duplicates on form submit by jQuery
- ajaxurl usage for a custom function
- How to call a function from functions.php with ajax?
- Ajax in a class instantiated via shortcode
- Custom Post type Ajax search results
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- PHP get_category() function redeclared
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- Find the method which AJAX GET calls
- How to Request a User to Register on Landing at a Site, Then Automatically Delete the Users Password on Logout?
- Private messaging – Getting and displaying the avatar/url of a message recipient
- AJAX Returning Way Too Many Posts
- display php code in header using wp_head()
- How do I change the Go To Categories link in the term_updated_messages
- WP Custom tables query
- How to pass and validate nonce in custom REST routes
- getJSON response to PHP
- ajax problems on loading page [closed]
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- How can I display a Divi content inside a modal based on an AJAX request
- Function for Post Creation plugin for Gravity Forms
- check difference between two timestamp in custom plugin