I am running a site (www.example.com) that uses iframes from a subdomain (test.example.com).
In order to communicate between them (due to same-origin policy) I need to set the JavaScript variable document.domain = 'example.com'
. This is all fine and works great.
However, when Gravity Forms in introduced, the Ajax-enabled submissions fail (because presumably the Ajax code returned that gets loaded into the hidden GF iframe expects the standard http://www.example.com)
Sadly, browsers do NOT let you reset the document domain back to the original, once you have set it to the superdomain.
Long story short: I need to be able to insert the document.domain
code into the HTML returned by the Ajax submission of a form. I don't see a JavaScript hook for such a thing. Is there a way to do this via a PHP hook?
I know I can just turn Ajax off and it'll work, but that's not an elegant solution.
Any advice would really be appreciated! Thanks.