【发布时间】:2016-12-01 17:14:43
【问题描述】:
我需要使用 Contact 7 来获得一个嵌入式表单,将信息提交到我的 Viral Loops 帐户。
表单提交后需要运行如下代码,即on_sent_ok:
VL.options.form_fields.form_firstName = $("#firstname").val(); //capture the first name
VL.options.form_fields.form_email = $("#email").val(); //capture the email
VL.options.form_fields.form_lastName = $("#lastname").val(); //capture the last name (if applicable in your form)
//submit the participant to Viral Loops
VL.createLead(function() {
//any logic to run after the participation
});
我不知道在哪里或如何添加它,因为您只能在高级设置中使用 on sent ok 的一行代码。
提前致谢!! :)
【问题讨论】:
-
这不是最可读的,但是为什么不把你所有的js放在一行上呢?分号将负责区分任何一条语句的结尾。
-
那个或者你可以把它作为一个函数放在你已经入队的外部 JS 文件中 (developer.wordpress.org/reference/functions/wp_enqueue_script) 并从 on_sent_ok 调用该函数
标签: javascript wordpress forms contact-form-7