ajax XMLHttpRequest post get
/*ÔÚÓÐÖÐÎIJÎÊýʱ,½ÓÊÕ·½ÐèҪʹÓÃUTF-8·½Ê½¶ÔÊý¾Ý½øÐнâÂë
*²»Ö§³Öpost¸½¼þ
*/
function getXmlHttpRequest() {
var xmlHttpRequest = null;
try {
xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e1) {
try {
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttpRequest = null;
}
}
if (xmlHttpRequest == null && typeof(XMLHttpRequest) != 'undefined') {
xmlHttpRequest = new XMLHttpRequest();
}
return xmlHttpRequest;
}
/*ʹÓÃpost·½Ê½·¢ËÍÊý¾Ý
*url:submit·¾¶
*arguments:²ÎÊý,Èçname=jese&sex=womanz,ÖÐÎÄÊý¾ÝʱʹÓÃ'name='+getEncodeURIComponent('ÀîËÄ')+'&sex='+getEncodeURIComponent('ÄÐ')½øÐбàÂë
*synchFlag:ͬ²½±ê¼Ç,falseΪͬ²½·½Ê½,trueΪÒì²½·½Ê½
*returnType:·µ»ØÄÚÈÝÀàÐÍ0=responseBody;1=responseStream;2=responseText;3=responseXML
*execute:ΪÒì²½·½Ê½Ìá½»ºóµÄ»Øµ÷º¯Êý,´Ëº¯ÊýÓÃÓÚ´¦Àí·µ»ØÊý¾Ý,¸ñʽΪfunction (obj){},objΪ·µ»ØÄÚÈÝ
*/
function postData(url, arguments, synchFlag, returnType, execute) {
var xmlHttpRequest = getXmlHttpRequest();
if (xmlHttpRequest == null) return false;
xmlHttpRequest.open("POST", url, synchFlag);
xmlHttpRequest.setRequestHeader("CONTENT-TYPE", "application/x-www-form-urlencoded");
xmlHttpRequest.setRequestHeader("Content-Length", arguments.length);
if (synchFlag) {
xmlHttpRequest.onreadystatechange = function() {
&nb
Ïà¹ØÎĵµ£º
function saveObj(){
var userName = document.getElementById("userName").value;
checkUserName(userName);
}
//ʹÓÃajaxʵÏÖÒ³ÃæÎÞˢй¦ÄÜ;
var xmlHttpRequest;
function createXMLHttpRequest(){
if(windo ......
Ó¦ÏîÄ¿ÐèÇ󣬲âÊÔÁËÏÂ×Ô¶¯·¢ËÍÓʼþµÄ¹¦ÄÜ£¬ÒÔʵÏÖ£¬ÏÂÃæ·Ö±ð½éÉÜǰ̨µÄ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- ......
Ajax
Ö÷
Òª×é³É²¿·Ö
Ajax
ÊÇ
Asynchronous JavaScript and XML
£¨ÒÔ
¼°
DHTML
µÈ£©µÄËõд¡£
Ajax
ÓÉ
HTML
¡¢
JavaScript™
¼¼Êõ¡¢
DHTML
ºÍ
DOM
×é³É£¬ÕâÒ»½Ü³öµÄ·½·¨¿ÉÒÔ½«±¿×¾µÄ
Web
½çÃæ×ª»¯³É½»»¥ÐÔµÄ
Ajax
Ó¦ÓóÌÐò¡£
AjaxµÄºËÐÄÊÇJavaScript¶ÔÏó XmlHttpRequest¡£¸Ã¶ÔÏóÔ ......
<html>
<body>
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Inte ......
ºÃ¾Ã²»ÅöWEBµÄ¶«¶«ÁË,×î½üѧϰ£Ó£Á£ÐµÄ£Â£Ó£Ð¼¼Êõ£¬ÓÖÓõ½ÕâЩ£¬Ë³±ãתƪÎÄÕ£¬±¸²é£®
ÔÎĵØÖ·: http://www.ibm.com/developerworks/cn/xml/x-ajaxxml2/
Ajax ºÍ XML:
Îå
ÖÖ³£¼û Ajax ģʽ
¿ÉÁ¢¼´Ê¹ÓÃÕâЩ·Ç³£ÓÐÓÃµÄ Ajax Éè¼ÆÄ£Ê½
ÎĵµÑ¡Ïî
<tr valign="top"><td width="8">< ......