简体   繁体   English

如何将wordpress页面标题传递给wufoo javascript

[英]How to pass a wordpress page title to a wufoo javascript

I'm trying to enter the page title value in the javascript code from a wufoo form in a wordpress page. 我正在尝试从wordpress页面中的wufoo形式的javascript代码中输入页面标题值。

I've added the following code: 我添加了以下代码:

'autoResize':true,
'height':'1092',
'async':true,
'host':'wufoo.com',
'header':'show',
'defaultValues':'field9=**boomboom**',
'ssl':true};

I need to replace the boomboom with the post page title so I can capture the name of the post every time the form is summited. 我需要用帖子页面标题替换一下boomboom ,以便boomboom时都可以捕获帖子的名称。

Thanks, Manuel 谢谢,曼努埃尔

Appreciate you help Dan, 感谢您帮助Dan,

<div id="wufoo-s121gtwf14azmyy">
Fill out my <a href="https://creativedoing.wufoo.com/forms/s121gtwf14azmyy">online form</a>.
</div>

<script type="text/javascript">
/* <![CDATA[ */
var postData = {"postTitle":"<?php echo get_the_title(); ?>"};
/* ]]> */
</script>

<script type="text/javascript">var s121gtwf14azmyy;(function(d, t) {
var s = d.createElement(t), options = {
'userName':'creativedoing',
'formHash':'s121gtwf14azmyy',
'autoResize':true,
'height':'1092',
'async':true,
'host':'wufoo.com',
'header':'show',
'defaultValues':'field1=**<?php echo get_the_title(); ?>**',
'ssl':true};

s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'www.wufoo.com/scripts/embed/form.js';
s.onload = s.onreadystatechange = function() {
var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
try { s121gtwf14azmyy = new WufooForm();s121gtwf14azmyy.initialize(options);s121gtwf14azmyy.display(); } catch (e) {}};
var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr);
})(document, 'script');</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM