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
- 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
- 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
- Click loads template via ajax
- Making Quote Plugin more efficient
- How to speed up admin-ajax.php in wordpress
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- How to test nonce with AJAX – Plugin development
- Swapping wp_dropdown_categories function with wp_category_checklist
- How to access global variable $menu inside a class function
- How can I remove a function that has been added to wordpress with add_filter?
- PHP 8, AJAX mail form to function.php doesn’t work
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- Why ajax doesn’t work on certain wordpress hooks?
- How to call plugin function per site in a multisite?
- adjust section according to country?
- dynamic dependent select dropdown
- Function to capture a value and store it in a variable
- how to make custom ajax handler?
- WordPress Custom field Colors
- How to disable controls in theme customizer?
- how to update and display an option without reloading the page
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- How to use html inside a functions.php code?
- Plugin Generate Unexpected output during activation
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- 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
- 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?
- 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?
- Submit form to db
- AJAX function not working [closed]
- 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?
- 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
- How to change basename url for wp-admin?
- 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?
- 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?
- 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?
- get_the_author_meta( ‘ID’ ) just return 1
- Update $wpdb query with AJAX
- 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
- WordPress Ajax filter: Create two loops for different output styles?
- Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
- 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
- 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
- Gravity Forms Marketo Plugin Feed [closed]
- wordpress ajax return 0
- Modify category archive page loop on functions.php
- Modify php code to pass a page id as a parameter in order to create a breadcrumb
- Permission error on plugin save
- Trouble using wordpress functions in a pop-up modal form
- Adding Gravity Form With if(is_page) Is Not Working
- AJAX & PHP | Call a specific PHP function from a PHP file via AJAX?
- ajax form function error
- Cookie not created in AJAX request
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- display php code in header using wp_head()
- WP Custom tables query
- How to pass and validate nonce in custom REST routes
- ajax problems on loading page [closed]