AjaxÎÞË¢ÐÂ×Ô¶¯·¢ËÍÓʼþ
Ó¦ÏîÄ¿ÐèÇ󣬲âÊÔÁËÏÂ×Ô¶¯·¢ËÍÓʼþµÄ¹¦ÄÜ£¬ÒÔʵÏÖ£¬ÏÂÃæ·Ö±ð½éÉÜǰ̨µÄAjaxºÍºǫ́c#
ǰ̨£º
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SendEmail.aspx.cs" Inherits="SendEmail" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ÿ¸ôÊ®Ãë鐘×Ô動發ËÍEmail</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="10000" ontick="Timer1_Tick">
</asp:Timer>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<div>
</div>
</form>
</body>
</html>
----------------------------------------------------------------------------------------------------------------------------------------------
ºǫ́£º
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net.Mail;
public partial class SendEmail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
Ïà¹ØÎĵµ£º
ÒòΪAJAXĬÈϵÄÊÇUTF-8£¬ËùÒÔ½«JSPÒ³ÃæºÍºǫ́servletµÄ±àÂë¸ñʽ¶¼ÉèÖÃΪUTF-8×îºÃ£¬Ò²ÓÐÀûÓÚÒÔºóµÄÀ©Õ¹¡£
È»ºóÔÚ¶ÔÓ¦µÄ¸ñʽÏÂÃ棨dopost»òÕßdoget£©£¬¼ÓÉÏÕ⼸¾ä
response.setContentType("text/html");
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("UTF-8");
±¾ÈËÇײ⣬µ¯³öµ ......
¹ØÓÚÔÚAJAXÖÐGET»ØµÄResponseTextÖÐÎÄÂÒÂëµÄ×î¼ò½â¾ö°ì·¨
//Èç¹û´«ËͲÎÊýÊÇÖ±½Ó¸³ÓèµÄ£¬¾Í»á²úÉúÂÒÂë!
´úÂëÈçÏÂ:
http_request.open("POST",url,true);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send("action="+strName+"&val="+val); //Èç¹ûvalµÄ ......
var x,y;
//ÕâÊÇÒ»¸öͨ¹ýAJAXÈ¡µÃÌáʾÐÅÏ¢µÄ·½·¨
function over(noteContent){
//¼Ç¼Ê¼þ·¢ÉúʱµÄÊó±êλÖÃ
x = event.clientX;
y = event.clientY;
//ÏÔʾ¹¤¾ßÌáʾ
document.getElementById(" ......
$.ajax({
type: "POST", //·ÃÎÊWebServiceʹÓÃPost·½Ê½ÇëÇó
......
function saveObj(){
var userName = document.getElementById("userName").value;
checkUserName(userName);
}
//ʹÓÃajaxʵÏÖÒ³ÃæÎÞˢй¦ÄÜ;
var xmlHttpRequest;
function createXMLHttpRequest(){
if(windo ......