javascript to ajax(Ò»)
AJAX ÔÚä¯ÀÀÆ÷Óë Web ·þÎñÆ÷Ö®¼äʹÓÃÒì²½Êý¾Ý´«Ê䣨HTTP ÇëÇ󣩣¬ÕâÑù¾Í¿ÉʹÍøÒ³´Ó·þÎñÆ÷ÇëÇóÉÙÁ¿µÄÐÅÏ¢£¬¶ø²»ÊÇÕû¸öÒ³Ãæ¡£
AJAX »ùÓÚ Web ±ê×¼
AJAX »ùÓÚÏÂÁÐ Web ±ê×¼£º
JavaScript
XML
HTML
CSS
ÔÚ AJAX ÖÐʹÓÃµÄ Web ±ê×¼Òѱ»Á¼ºÃ¶¨Ò壬²¢±»ËùÓеÄÖ÷Á÷ä¯ÀÀÆ÷Ö§³Ö¡£AJAX Ó¦ÓóÌÐò¶ÀÁ¢ÓÚä¯ÀÀÆ÷ºÍƽ̨¡£
Deafault.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="XmlWeb._Default" %>
<!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 id="Head1" runat="server">
<title>ÎÞ±êÌâÒ³</title>
<script language="javascript" type="text/javascript">
function ajaxFunction() {
var xmlhttp;
try {
xmlhttp = new XMLHttpRequest();
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlht
Ïà¹ØÎĵµ£º
Ò³ÃæÌá½»Êý¾ÝÒ»°ãÓÐÁ½ÖÖ·½·¨£ºget,post¡£post¾ÍÊÇËùνµÄformÌá½»£¬Ê¹ÓÃÊÓͼ£»getÊÇͨ¹ýurlÌá½»¡£
Get·½·¨Ò»°ãÓúǫ́´úÂ루Èçasp,asp.net£©»ñµÃ²ÎÊý£¬´úÂëºÜ¼òµ¥£ºRequest.QueryString["id"];¼´¿É»ñÈ¡¡£
ÓÐЩʱºòÐèÒªÖ±½ÓÔÚǰ̨»ñÈ¡url²ÎÊý£¬ÒªÓõ½javascript£¬jsûÓÐÖ±½Ó»ñÈ¡url²ÎÊýµÄ·½·¨£¬ÄÇô£¬ÎÒÃÇÈçºÎͨ¹ýjs ......
1¡¢JS½âÊÍ˳Ðò
JavaScriptÊÇ°´HTMLÎĵµÁ÷˳ÐòÖ´Ðеģ¬·Ö<script>¿é˳ÐòÖ´ÐУ¬JSÊÇÏÈÔ¤±àÒëÔÙÖ´ÐУ¬È»ºóÔٱ߱àÒë±ßÖ´ÐеÄÓïÑÔ£¬ÀýÈ磺
alert(a); //undefined
var a = 1;
alert(a); //1
Ϊʲô»á³öÏÖÉÏÊö½á¹ûÄØ£¿
´ð°¸£ºa±äÁ¿ÔÚÔ¤±àÒëµÄʱºò£¬ÒѾ´æÔÚÄÚ´æÖУ¬È»ºóJSÒýÇ濪ʼִÐÐJS´úÂë£ ......
Ajax(Asynchronous JavaScript and XML)˵µ½µ×¾ÍÊÇÒ»ÖÖä¯ÀÀÆ÷Òì²½¶ÁÈ¡·þÎñÆ÷ÉÏXMLÄÚÈݵļ¼Êõ¡£ÏÖÔڵļ¼Êõ·²ÊǸúXML³¶ÉϹØϵ£¬ÔÙ¼ÓÉϸö¸ÅÄî×ö»Ï×Ó£¬¾ÍÏñ½ð×°ÁËÒ»Ñù£¬×§µÃ²»ÐС£ÃÅÍâ µÄÈË¿´µÃºÜÊÇÈÈÄÖ£¬ÃÅÀïµÄÈËÒ¡Ò¡Í·²»ÍâÈçÊÇ¡£XMLÄØ£¬¿çƽ̨µÄг±ÓïÑÔ£¿ÆäʵXML£½TXT¡£
XMLÖ»ÊÇ·ûºÏºÜ¶à¹æ·¶µÄÎı¾¡£Ëü±¾Éíʲô¶¼²»ÊÇ£¬Ö ......
<html>
<head>
<title>jQuery Ajax ʵÀýÑÝʾ</title>
</head>
<script language="javascript" src="../lib/jquery.js"></script>
<script language="javascript">
$(document).ready(function ()
{
$('#send_ajax').click(function (){
&nb ......
jquery Ajax ´«µÝºº×Öµ½ servlet ʱ³öÏÖÂÒÂëµÄÎÊÌâ
2009Äê11ÔÂ25ÈÕ ÐÇÆÚÈý ÏÂÎç 02:28
jquery Ajax ´«µÝºº×Öµ½ servlet ʱ³öÏÖÂÒÂëµÄÎÊÌâ
ÔÚjsÖжÔÐèÒªµÄ´«Ë͵IJÎÊý½øÐбàÂë
encodeURI(encodeURI(param))
ÔÚ·þÎñÆ÷½ÓÊܺó¶ÔÆä½øÐнâÂë
String param = URLDecoder.decode(request.getParameter("param"),"utf-8");
......