简体   繁体   English

无法在Wordpress网站上添加联系表格

[英]Having trouble adding a contact form to wordpress site

I am trying to add a contact form to my wordpress site, the form I am using is identical to one I have used on this non wordpress site http://drains2go.com/contact.php the only thing I hae done differently has been update the action attribute to: 我正在尝试将联系表单添加到我的wordpress网站,我使用的表单与我在此非wordpress网站http://drains2go.com/contact.php上使用的表单相同,唯一不同的是将action属性更新为:

<form id="contact-form" action="<?php bloginfo('stylesheet_directory') ?>/processForm.php" method="post">

Problem is that my when I submit the form my javascript ajax call isnt made and the action attr link is followed instead of the default state being disabled. 问题是,当我提交表单时,我的javascript ajax调用未进行,并且遵循动作attr链接,而不是禁用默认状态。

Javascript Java脚本

$.ajax({
        url : contactForm.attr('action') + '?ajax=true',
        type : contactForm.attr('method'),
        data : contactForm.serialize(),
        success : function() {

Is the problem that I have set the action as the full link? 我将操作设置为完整链接的问题吗?

http://localhost/jmccplantsales/wp-content/themes/child-theme/processForm.php

If you're using custom theme (other than the default or wordpress builtin themes like twentyelevan, twentyten etc). 如果您使用的是自定义主题(默认主题或wordpress内置主题除外,例如二十多岁,二十岁等)。

  1. Change 更改

     <form id="contact-form" action="<?php bloginfo('stylesheet_directory')?>/processForm.php" method="post"> 
  2. And try to use this one 并尝试使用这一

     <form id="contact-form" action="<?php bloginfo('template_url')?>/processForm.php" method="post"> 

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

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