Ajax ¼òµ¥Ê¾Àý
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>xmlhttprequest ajax demo</title>
<script type ="text/javascript" language ="javascript" >
var req; //¶¨Òå±äÁ¿£¬ÓÃÀ´´´½¨xmlhttprequest¶ÔÏó
function creatReq() // ´´½¨xmlhttprequest,ajax¿ªÊ¼
{
var url="ajaxServer.aspx"; //ÒªÇëÇóµÄ·þÎñ¶ËµØÖ·
if(window.XMLHttpRequest) //·ÇIEä¯ÀÀÆ÷¼°IE7(7.0¼°ÒÔÉϰ汾)£¬ÓÃxmlhttprequest¶ÔÏó´´½¨
{
req=new XMLHttpRequest();
}
else if(window.ActiveXObject) //IE(6.0¼°ÒÔϰ汾)ä¯ÀÀÆ÷ÓÃactivexobject¶ÔÏó´´½¨,Èç¹ûÓû§ä¯ÀÀÆ÷½ûÓÃÁËActiveX,¿ÉÄÜ»áʧ°Ü. {
req=new ActiveXObject("Microsoft.XMLHttp");
}
if(req) //³É¹¦´´½¨xmlhttprequest
{
req.open("GET",url,true); //
Ïà¹ØÎĵµ£º
¹«Ë¾×î½ü¸øÎÒÒ»¸öÈÎÎñ£º°ÑÒ»¸öÓÃiframe×öµÄÁôÑÔ°å¸ÄдÓÃAjax×ö£¬ÕâÑù×öµÄÔÒòÊÇ£º¶ÔËÑË÷ÒýÇæµÄÓÅ»¯¡£ËäÈ»ºÜÔç¾ÍÖªµÀAjax¿ÉÒÔ×ö¾Ö²¿Ë¢Ð£¬µ«ÒòΪ×Ô¼ºÊǸձÏÒµÈëÖ°µÄ²ËÄñ£¬½ö½öÊÇÖªµÀÓÐÕâô¸ö¼¼Êõ¿ÉÒÔ×öÕâÑùÒ»¹¦ÄܶøÒÑ¡£Ò»±ßѧһ±ß×ö¡£ÏÖÔÚÕ⹦ÄÜ»¹Ã»ÍêȫŪºÃ£¬ÏÈ×ܽáÏÂ˼·ÒÔ±ã¸üºÃµÄѧϰ£º
ÒµÎñÂß¼£ºÔÚÏßÑÐÌֻᣬÌáÎÊÕßÒ³ ......
Ò»¸öajaxÇëÇóÒ»¸öjspÎļþ£¬²Ù×÷³É¹¦,jspÎļþout.println("1");µ«ÊÇÿ´Î³É¹¦ºóxmlHttp.responseText=='1'×ÜÊÇΪfalse£¬
ÓÃencodeURIComponent¿´xmlHttp.responseText£¬·¢ÏÖ×îºó¶àÁË%0A%0D£¬°Ù¶ÈһϠÓÃÀ´ÊÇ»»ÐУ¬
jspÎļþÖеÄout.println……°ÑlnÈ¥µôÔÙ´Î±È½Ï ³É¹¦ = =¡ ......
function verify() {
//½â¾öÖÐÎÄÂÒÂéÎÊÌâµÄ·½·¨1£¬Ò³Ãæ¶Ë·¢³öµÄÊý¾Ý×÷Ò»´ÎencodeURI£¬·þÎñÆ÷¶ÎʹÓÃnew String(old.getBytes("iso8859-1"),"UTF-8");
//½â¾öÖÐÎÄÂÒÂéÎÊÌâµÄ·½·¨2£¬Ò³Ãæ¶Ë·¢³öµÄÊý¾Ý×÷Á½´ÎencodeURI£¬·þÎñÆ÷¶ÎʹÓÃURLDecoder.decode(old,"UTF-8")
var url = &qu ......
ÔÚÒѾ·¢²¼µÄ ASP.NET2.0 ÖУ¬ÎÞË¢ÐÂÒ³Ãæ¿ª·¢Ïà¹Ø²¿·Öͬ beta2 Óв»Éٸ͝¡£¶øÇÒÔÚÔ½À´Ô½¶àµÄ Ajax ¿ª·¢°ü±»¿ª·¢³öÀ´µÄÇé¿öÏ£¬ ASP.NET2.0 ×Ô´øµÄÎÞË¢ÐÂÒ³Ãæ¼¼ÊõûÓб»ºÜ¶àÈËÁ˽⣬ÉõÖÁ²»ÉÙÈËÈÏΪ¸Ã¹¦ÄÜÓÐЩ“¼¦Àß”¡£µ«Èç¹ûÎÒÃǽö½öÊÇÔÚ³ÌÐòÖмÓÈëºÜÉÙ²¿·ÖµÄ Ajax ÌØÐÔ£¬ Atlas ¡¢ Ajax.Net µÈ¾ÍÏÔµÃÓÐЩ&ldq ......
upload.jsp
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP ''upload.jsp'' starting page</title>
&n ......