<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Loading Gravity Forms dynamically with ajax</title>
		<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax</link>
		<description>Gravity Support Forums Topic: Loading Gravity Forms dynamically with ajax</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 08:03:04 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/loading-gravity-forms-dynamically-with-ajax" rel="self" type="application/rss+xml" />

		<item>
			<title>Andy on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-102421</link>
			<pubDate>Thu, 13 Dec 2012 21:54:26 +0000</pubDate>
			<dc:creator>Andy</dc:creator>
			<guid isPermaLink="false">102421@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Paddleboot, could you please explain the below further?&#60;/p&#62;
&#60;p&#62;After saving, you can fire an AJAX call (using WP's AJAX implementation) for this page's url (i.e. example.org/my-ajax-form/). &#60;/p&#62;
&#60;p&#62;many thanks,&#60;br /&#62;
Andy
&#60;/p&#62;</description>
		</item>
		<item>
			<title>paddelboot on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-88464</link>
			<pubDate>Wed, 07 Nov 2012 14:36:27 +0000</pubDate>
			<dc:creator>paddelboot</dc:creator>
			<guid isPermaLink="false">88464@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have only found one workaround:&#60;/p&#62;
&#60;p&#62;1. Consider this page template:&#60;br /&#62;
 `&#38;lt;?php&#60;br /&#62;
/**&#60;br /&#62;
 * Load Gravity forms via AJAX&#60;br /&#62;
 *&#60;br /&#62;
 * Template Name: load form&#60;br /&#62;
 */&#60;/p&#62;
&#60;p&#62;// Display form&#60;br /&#62;
gravity_form( your_form_id, FALSE, TRUE, FALSE, NULL, FALSE );&#60;br /&#62;
exit;&#60;br /&#62;
?&#38;gt;`&#60;/p&#62;
&#60;p&#62;2. In the editor, create a new page using the above template. Let's say you title this page 'My ajax form'. After saving, you can fire an AJAX call (using WP's AJAX implementation) for this page's url (i.e. example.org/my-ajax-form/). This call should return just the form.&#60;/p&#62;
&#60;p&#62;Let me know if it works for you,&#60;/p&#62;
&#60;p&#62;Paddelboot
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Brad Trivers on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-87558</link>
			<pubDate>Mon, 05 Nov 2012 10:33:17 +0000</pubDate>
			<dc:creator>Brad Trivers</dc:creator>
			<guid isPermaLink="false">87558@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi,&#60;br /&#62;
I would also like to call and initialize a Gravity Form via an AJAX request.  I only want to load the form and display it on the page/post when the user takes an action (e.g. clicking a link or button).&#60;/p&#62;
&#60;p&#62;I also took at stab at this by using the standard WordPress ajax functionality, but the form loads like it does in the WP Admin area as you say.  For example in my theme's functions.php file I:&#60;/p&#62;
&#60;p&#62;A) Enqueued and localized the javascript.&#60;br /&#62;
B) Created the &#34;ajax&#34; function to load the form that will called by the javascript.&#60;/p&#62;
&#60;p&#62;see &#60;a href=&#34;http://pastebin.com/yUQEKa9k&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/yUQEKa9k&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;and then&#60;br /&#62;
C) Created the appropriate javascript with the action trigger and ajax call to the form load function.&#60;/p&#62;
&#60;p&#62;see &#60;a href=&#34;http://pastebin.com/fLy4apnJ&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com/fLy4apnJ&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Any help would be appreciated.&#60;/p&#62;
&#60;p&#62;Thanks.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>paddelboot on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-67838</link>
			<pubDate>Wed, 25 Jul 2012 06:40:07 +0000</pubDate>
			<dc:creator>paddelboot</dc:creator>
			<guid isPermaLink="false">67838@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am trying the same, and I cannot get past this IS_ADMIN constant either, which means I cannot fire AJAX calls the WordPress way. It might be a niche, still it would be nice to be considered in the Gravity Forms source code.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>taxbax on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-52760</link>
			<pubDate>Sun, 18 Mar 2012 03:50:19 +0000</pubDate>
			<dc:creator>taxbax</dc:creator>
			<guid isPermaLink="false">52760@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;So, I noticed that the action for the form submission was the same as my AJAX query that loaded the page - not good. I couldn't figure out why this was happening so I decided to just fix it. I looked back at past sites using GF and saw that the form action should just be directed at the slug. Within the loop of the AJAX page, I added this jQuery/PHP function:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
	 $root = get_bloginfo(&#38;#39;url&#38;#39;);
	 $action = str_replace($root,&#38;#39;&#38;#39;,get_permalink()); ?&#38;gt;
	 &#38;lt;script&#38;gt;
	 if ($(&#38;#39;form&#38;#39;).is(&#38;#39;*&#38;#39;)) {
	 $(&#38;#39;form&#38;#39;).get(0).setAttribute(&#38;#39;action&#38;#39;, &#38;#39;&#38;lt;?php echo $action ?&#38;gt;&#38;#39;)
	 $(&#38;#39;form&#38;#39;).click(function(e) { e.stopPropagation();})};&#38;lt;/script&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;This simply gets the permalink, removes the root url, and, if there is a form, inserts it as the form action. I also had a weird issue where anchor tags on page would get activated my clicking on the form, really weird. The stopPropagation function disables that, phew!&#60;/p&#62;
&#60;p&#62;It works.&#60;/p&#62;
&#60;p&#62;I have a could things to do to it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>taxbax on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-52758</link>
			<pubDate>Sun, 18 Mar 2012 03:15:13 +0000</pubDate>
			<dc:creator>taxbax</dc:creator>
			<guid isPermaLink="false">52758@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Can you please post what you did
&#60;/p&#62;</description>
		</item>
		<item>
			<title>overit on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-51017</link>
			<pubDate>Thu, 01 Mar 2012 10:50:31 +0000</pubDate>
			<dc:creator>overit</dc:creator>
			<guid isPermaLink="false">51017@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi All,&#60;/p&#62;
&#60;p&#62;I actually attempted the same thing recently using self::get_form. The form is displayed, but appears as it would in the admin area with the field titles and options visible and the fields themselves disabled. I believe it's because the IS_ADMIN constant is true when an ajax request is fired from a logged in user ( I'm not sure about logged out users ).&#60;/p&#62;
&#60;p&#62;In any event, I don't think it's quite possible yet. Anyone else had better luck?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jeroenlh on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-49384</link>
			<pubDate>Tue, 14 Feb 2012 09:45:30 +0000</pubDate>
			<dc:creator>jeroenlh</dc:creator>
			<guid isPermaLink="false">49384@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi David,&#60;/p&#62;
&#60;p&#62;I had a look into the GF code and did some trails, but there seem to be to much javascript (initializing) problems when inserting the GForm into an existing page (using ajax).&#60;br /&#62;
Not sure if it is me, or the GF architecture that makes this difficult.&#60;/p&#62;
&#60;p&#62;For this moment I will park this (wanted) solution and implement it by calling separate dialog pages te 'classic' way. I might give it another try later, when I have some more time.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-49108</link>
			<pubDate>Fri, 10 Feb 2012 22:27:04 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">49108@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Jeroenlh,&#60;/p&#62;
&#60;p&#62;Calling and initializing a Gravity Form via an AJAX request is a fairly niche use case for Gravity Forms so there isn't much documentation on the subject. However, a good place to start is the parse_shortcode() function in gravityforms.php. You can see how it pulls the attributes from the shortcode and then uses these attributes to retrieve the form for display. Most notable is the get_form() function:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
self::get_form($id, $title, $description, false, $field_value_array, $ajax, $tabindex)&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I can't say for sure what issues you will encounter with this approach but hopefully this will give you a decent start.&#60;/p&#62;
&#60;p&#62;Good luck!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jeroenlh on "Loading Gravity Forms dynamically with ajax"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/loading-gravity-forms-dynamically-with-ajax#post-48426</link>
			<pubDate>Mon, 06 Feb 2012 09:38:05 +0000</pubDate>
			<dc:creator>jeroenlh</dc:creator>
			<guid isPermaLink="false">48426@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Is it possible to load GForms dynamically with ajax, e.g. to use in a jQuery modal dialog?&#60;/p&#62;
&#60;p&#62;I understand and found information/examples for: hiding the form on the page and show it when needed in a modal dialog. Or how to implement a GForm in a jQuery dialog in a iframe.&#60;/p&#62;
&#60;p&#62;But what I really want is to load the GForm when needed using ajax. &#60;/p&#62;
&#60;p&#62;The idea is that the visitor can edit, delete, etc. some items on the page and when doing so, an ajax call will get the needed GForm for that action and then show it in a modal dialog.&#60;/p&#62;
&#60;p&#62;Is this possible with GF?&#60;br /&#62;
Is there somewhere more info or documentation about usage like this?&#60;/p&#62;
&#60;p&#62;Thanx,&#60;br /&#62;
Jeroen.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
