简体   繁体   English

Ajax联系人表单激活

[英]Ajax Contact form activation

I downloaded a template which i have heavily modded, but i have no idea how to implement the contact form, my knowledge on js or ajax is close to nothing. 我下载了一个经过大量修改的模板,但是我不知道如何实现联系表,我对js或ajax的了解几乎没有。

the js code i found that pertains to the contact is as follows: 我发现与该联系人有关的js代码如下:

//FeedBack Form //反馈表

jQuery('.content_block').find('.form_field').each(function(){
    jQuery(this).width(jQuery(this).parent('form').width()-30);
}); 
jQuery('.login_form').find('.form_field').each(function(){
    jQuery(this).width(jQuery(this).parent('form').width()-30);
}); 
jQuery('.mc_input').each(function(){
    jQuery(this).width(jQuery(this).parents('.widget_mailchimpsf_widget').width()-32);
});         

jQuery('.commentlist').find('.stand_comment').each(function(){
    set_width = jQuery(this).width() - jQuery(this).find('.commentava').width() - 37;
    jQuery(this).find('.thiscommentbody').width(set_width);
}); 

jQuery('.feedback_go').click(function(){
    var par = jQuery(this).parents(".feedback_form");
    var name = par.find(".field-name").val();
    var email = par.find(".field-email").val();
    var message = par.find(".field-message").val();
    var subject = par.find(".field-subject").val();
    if (email.indexOf('@') < 0) {           
        email = "mail_error";
    }
    if (email.indexOf('.') < 0) {           
        email = "mail_error";
    }
    jQuery.ajax({
        url: "mail.php",
        type: "POST",
        data: { name: name, email: email, message: message, subject: subject },
        success: function(data) {
            jQuery('.ajaxanswer').hide().empty().html(data).show("slow");
            setTimeout("jQuery('.ajaxanswer').fadeOut('slow')",5000);
      }
    });
});

The html on contact page is as follows: 联系人页面上的html如下:

<form name="feedback_form" method="post" class="feedback_form">
<input type="text" name="field-name" value="Nombre" title="Name" class="field-name form_field">
<div class="clear"></div>
<input type="text" name="field-email" value="Email" title="Email" class="field-email form_field">
<div class="clear"></div>
<input type="text" name="field-subject" value="Sobre" title="Subject" class="field-subject form_field">
<div class="clear"></div>
<textarea name="field-message" cols="45" rows="5" title="Message" class="field-message form_field">Mensaje</textarea>
<div class="clear"></div>
<input type="reset" name="reset" id="reset2" value="Reiniciar" class="feedback_reset">
<input type="button" name="submit" class="feedback_go" id="submit2" value="Enviar!">
<div class="ajaxanswer"></div>
</form>

How do i cativate this to send emails to my email or do i need mailchimp?? 我该如何将其发送给我的电子邮件或我需要mailchimp? Im completely lost here and been googling with no answer in sight. 我在这里完全迷路了,一直在搜寻,看不到答案。

Please help!!! 请帮忙!!! :) :)

thank you. 谢谢。

You need PHP Mailer, that is how the mail.php works. 您需要PHP Mailer,这就是mail.php的工作方式。 As my site is written in ASP.NET, I've removed the PHP. 由于我的网站是用ASP.NET编写的,因此我删除了PHP。 However the second part of the java script does the post back message, using ajax, which fades in the out with the sucess/failure message. 但是,Java脚本的第二部分使用ajax执行回发消息,该消息随着成功/失败消息而淡出。 These are also in the PHP mail.php page. 这些也位于PHP mail.php页面中。

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

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