# Adding a query parameter to Gravity Forms ajax endpoint in js

**URL:** <https://community.gravityforms.com/t/adding-a-query-parameter-to-gravity-forms-ajax-endpoint-in-js/19228>\
**Category:** Get Help\
**Tags:** ajax, ajax-iframe\
**Created:** [April 12, 2025, 11:51am UTC](https://community.gravityforms.com/t/adding-a-query-parameter-to-gravity-forms-ajax-endpoint-in-js/19228 "2025-04-12T11:51:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wordpressgfdev002](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/wordpressgfdev002/32/15937_2.png) [@wordpressgfdev002](https://community.gravityforms.com/u/wordpressgfdev002)\
**Post date:** [April 12, 2025, 11:51am UTC](https://community.gravityforms.com/t/adding-a-query-parameter-to-gravity-forms-ajax-endpoint-in-js/19228/1 "2025-04-12T11:51:10Z")

</div>

Hi All,

Just wondering if its possible to add a query string parameter to gravity forms ajax endpoint so that it will post/get with something like admin-jax.php?param=1

Thanks

---

<div class="post-metadata">

**Author:** ![toothless](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/toothless/32/15995_2.png) [@toothless](https://community.gravityforms.com/u/toothless)\
**Post date:** [April 14, 2025, 2:45am UTC](https://community.gravityforms.com/t/adding-a-query-parameter-to-gravity-forms-ajax-endpoint-in-js/19228/2 "2025-04-14T02:45:18Z")

</div>

Hi GravityDev,

You can definitely add a query string parameter to the Gravity Forms AJAX endpoint.

1. First, you need to add the following custom JavaScript to your website. You can do this by putting the code in your theme’s JavaScript file or using a plugin that allows you to add custom scripts.
2. Copy and paste the following code into your JavaScript file:

```javascript
jQuery(document).ready(function($) {
    $(document).on('gform_post_render', function(event, formId) {
        // Change 1 to your actual form ID
        if (formId === 1) { 
            var originalAjaxUrl = gform.ajaxurl;

            // Add your parameter here
            gform.ajaxurl = originalAjaxUrl + '?param=1'; 
        }
    });
});

```

1. Make sure to change `1` to match the ID of your Gravity Form.
2. After you save the changes, test your form to ensure it’s working correctly with the new parameter.

This code will add `?param=1` to the AJAX request whenever that specific form is submitted.

For more details, please have a look at the following documentation.

> **[gform\_post\_render](https://docs.gravityforms.com/gform_post_render/)**
>
> This jQuery hook is fired every time the form is rendered to allow custom jQuery to be executed. This includes initial form load, going to the next/previous page on multi-page forms, form rendered with validation errors, confirmation message...

Give it a try, and let me know how that goes! 😄

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [May 14, 2025, 2:45am UTC](https://community.gravityforms.com/t/adding-a-query-parameter-to-gravity-forms-ajax-endpoint-in-js/19228/3 "2025-05-14T02:45:46Z")

</div>

Closed on May 14, 2025, 2:45am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
