新建一个页面,将以上代码写在form_load中客户端js中用$.ajax去访问这个页面即可。
解决方案 »
- 如何将word中的表格复制到另外一个word文件中
- 客户端怎么和服务器保存连接?
- 求助:怎样让服务器只接收指定远程ip发来的连接请求?
- 我想问一下高手关于List 集合的问题。
- ##########为什么我的treeview控件没有afterselect事件呀????
- 类套类??
- c# 怎样将粘贴转换成模拟按键
- 我自己做了一个图片共享的网站用Chrome或opera打卡正常,用IE8就打不开图片,显示一个小叉叉。
- 如何从数据库读出数据?
- 求c#serialport类实现串口通信的源代码
- 第一次玩C#,DataGridView绑定数据源,显示不出来,请解答,谢谢!
- 请教:在学习对图片加水印,不知道从哪里入手。
$(document).ready(
function() {
alert("123");
$("#Button2").click(
function (){
alert("456");
var code='<%=code%>';
alert(code);
var txtemail= $("#txtemail").val();
var txtemail=document.getElementById('txtemail').value;
alert(txtemail); $.ajax({
type:"POST",
contentType:"application/json; charset=utf-8",
url:"advisory.aspx/Send",
data:"{from:'[email protected]',to:"+txtemail+",cc:'{}',body:"+code+",subject:'邮件标题',mailServer:'smtp.qq.com',port:'25',user:'12345678',password:'123456'}",
dataType:'json',
success:function(data) {
if(data==1)
{
alert("发送成功");
var email=txtemail.Substring(txtemail.IndexOf('@') + 1);
window.location.href="http://mail.{0}"+email;
}
},
error: function()
{
alert("发生错误");
}
});
return false;
}
});
});
</script> <input id="Button2" type="button" value="验证" class="btn"/>
我执行到 $("#Button2").click(
function (){就没法执行了是哪里出错了,链接跳转也不对