ajaxÂÒÂëÎÊÌâ
JScript code:
function createRequest(){
if(window.XMLHttpRequest){
httpRequest=new XMLHttpRequest();
}else if(window.ActiveXObject){
try{
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
}
function sendRequest(url,nam1,nam2){
createRequest();
id1=nam1
id2=nam2
httpRequest.open("GET",url,true);
httpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=GB2312');
httpRequest.onreadystatechange=processResponse;
httpRequest.send(null);
}
function processResponse(){
if(httpRequest.readyState == 4){
if(httpRequest.status == 200){
//alert('200');
var result=httpRequest.responseText;
//var result=httpRequest.responseXML//.getElementsByTagName("div");
alert(result);
//var area=document.getElementById(id2);
//area.innerHTML='<textarea rows=7 cols=49>'+result.value+'</textarea>'
Ïà¹ØÎÊ´ð£º
ÔÚ¼ÒÑо¿ajax£¬¿´Á˱ðÈ˵ÄÒ»¸öÍøÉϹºÎïÉ̳ÇÏîÄ¿µÄÔ´´úÂ룬×Ô¼ºÒ²À´·Â±ðÈ˵Ķ«Î÷Á·Ï°Á·Ï°£¬Ã»Ïë³öÎÊÌâÁË£¡Ò»ÏµÄÕâЩ´úÂëÊÇÎÒ·ÂÕÕ±ðÈËдµÄ¡£ÎÒÊÇÏëÈÃ×¢²áµÄÈËÌîдÓû§Ãû£¬¹â±êÀ뿪Óû§ÃûºóÃæµÄÌîд¿Õ°×´¦ºóÁ¢¿ÌÀûÓÃaj ......
http://localhost:8080/xx/zz.do ÏÔʾ outµÄ xml Êý¾Ý
xml.open("GET",arguments[0],true);// arguments[0]ÊÇ /xx/zz.do
xml.send();
alert(arguments[0]);//Õâ±ßÓÐ
x ......
»Øµ÷º¯ÊýÈçÏ£º
function deleteCallBack(data)
{
if(data=="ɾ³ý³É¹¦")
{
alert(data);
location.reload();
}
else
{
alert(data);
}
}
²»Ìøת Ö»ÊÇÏÔʾalertÐÅÏ ......
HuiFu.aspxÒ³Ãæ
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="HuiFu.aspx.cs" Inherits="fdfdcs" %>
<!DOCTYPE html PUBLIC &q ......