简体   繁体   English

.Net Ajax jQuery表单

[英].Net Ajax jquery form

How to send email by .net, with ajax-jquery requests ? 如何通过.net发送带有ajax-jquery请求的电子邮件?

I am new to .net so dont really know how to do it, but i dont think it is a long code, can anyone help me ? 我是.net的新手,所以真的不知道该怎么做,但是我不认为这是一个长代码,有人可以帮助我吗?

HTML 的HTML

 <form action="" method="get" id="mapKontaktForm" onsubmit="return false;">
      <input type="text" value="Indtask dit navn" />
      <input type="text" value="Indtask dit tlf. nr." />
      <input type="text" value="Indtask dit post nr." />
      <input type="submit" value="Send" id="mapFormSubmit" onclick="return false;" />
 </form>

jquery-ajax jQuery的ajax

$('#mapFormSubmit').click(
                function(){
var name = $('#mapKontaktForm input:nth-child(1)').val();
var phone = $('#mapKontaktForm input:nth-child(2)').val();
var post = $('#mapKontaktForm input:nth-child(3)').val();

var dataString = 'name='+ name + '&phone=' + phone + '&post=' + post;  

$.ajax({  
    type: "GET",  
    url: "/files/billeder/../Templates/Designs/Ideal2011/js/contactForm.aspx",  
    data: dataString,  
    success: function() { 
           $('.acceptBox').fadeIn(1000); 
         },
         error: function(){
               $('.errorBox').fadeIn(1000);  
          }
    });  
    return false;
}

)

What should be in aspx or ashx file to send these three values by email ? 要通过电子邮件发送这三个值,aspx或ashx文件应该是什么?

you have to read the values from the QueryString object and send it with help of the smtp classes from c# 您必须从QueryString对象中读取值,并借助c#的smtp类将其发送

look here for howto send a mail: http://www.codegod.biz/WebAppCodeGod/Send-eMail-System-Net-Mail-Smtp-C-AID58.aspx 在此处查找如何发送邮件: http : //www.codegod.biz/WebAppCodeGod/Send-eMail-System-Net-Mail-Smtp-C-AID58.aspx

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

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