<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>index</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
body{
font-size:0.75em;
border:0;
margin:250px 0 0 0;
padding:0;
}
#content{
width:450px;
margin:auto;}
#key{
width:30 ......
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>index</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
body{
font-size:0.75em;
border:0;
margin:250px 0 0 0;
padding:0;
}
#content{
width:450px;
margin:auto;}
#key{
width:30 ......
ajax¼¼ÊõÊÇʹҳÃæÄֲܾ¿Ë¢ÐµÄÒ»ÖÖ¼¼Êõ,È«³ÆÓ¦¸ÃÊÇasynchronous JavaScript and xml´Ó¼¸¸öµ¥´Ê¾ÍÖªµÀËüµÄÇëÇóÏìÓ¦µÄ´¦ÀíÊÇÒì²½µÄ,¶øÇÒʹÓõÄÊÇJavaScriptºÍxml¼¼Êõ.
ÎÒÃÇÔÚjavaÖÐʹÓÃajax¼¼Êõ×î¼òµ¥µÄÊÇʹÓÃËüµÄÒ»¸ö¿ò¼ÜdwrÖ»Òªµ¼ÈëÕâ¸ö°ü,×öÏàÓ¦µÄÅäÖÃ,¿ÉÊÇÎÒҪ˵µÄÊDZȽÏÂé·³µÄ¾ÍÊÇʹÓÃXmlHttpRequest×é¼þ.¾ßÌåµÄ´úÂëÈçÏÂ:1¡£³õʼ»¯·½·¨ÓÃÀ´Íê³ÉºËÐĶÔÏóµÄ³õʼ»¯.µ±È»ÕâЩ¶¼ÊÇÔÚJavaScriptÖÐÈ¡±àд.
var xmlRequest;
function createXMLRequest()
{
//Ê×ÏÈÅжÏä¯ÀÀÆ÷
if(windows.xmlHttpRequest)//»ðºüä¯ÀÀÆ÷
{
xmlRequest=new xmlHttpRequest;
}
if(IE.ActiveXObject)
{
xmlRequest=new ActiveXObject("microsoft.xmlHttp");
}
}
//ºÍ·þÎñÆ÷½¨Á¢Á¬½Ó
function search()
{
init();
var words = document.getElementById("words").value;
ajaxCoreObject.open("POST","DictServlet",true);
ajaxCoreObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajaxCoreObject.onreadystatechange = callBack;
aj ......
ajax¼¼ÊõÊÇʹҳÃæÄֲܾ¿Ë¢ÐµÄÒ»ÖÖ¼¼Êõ,È«³ÆÓ¦¸ÃÊÇasynchronous JavaScript and xml´Ó¼¸¸öµ¥´Ê¾ÍÖªµÀËüµÄÇëÇóÏìÓ¦µÄ´¦ÀíÊÇÒì²½µÄ,¶øÇÒʹÓõÄÊÇJavaScriptºÍxml¼¼Êõ.
ÎÒÃÇÔÚjavaÖÐʹÓÃajax¼¼Êõ×î¼òµ¥µÄÊÇʹÓÃËüµÄÒ»¸ö¿ò¼ÜdwrÖ»Òªµ¼ÈëÕâ¸ö°ü,×öÏàÓ¦µÄÅäÖÃ,¿ÉÊÇÎÒҪ˵µÄÊDZȽÏÂé·³µÄ¾ÍÊÇʹÓÃXmlHttpRequest×é¼þ.¾ßÌåµÄ´úÂëÈçÏÂ:1¡£³õʼ»¯·½·¨ÓÃÀ´Íê³ÉºËÐĶÔÏóµÄ³õʼ»¯.µ±È»ÕâЩ¶¼ÊÇÔÚJavaScriptÖÐÈ¡±àд.
var xmlRequest;
function createXMLRequest()
{
//Ê×ÏÈÅжÏä¯ÀÀÆ÷
if(windows.xmlHttpRequest)//»ðºüä¯ÀÀÆ÷
{
xmlRequest=new xmlHttpRequest;
}
if(IE.ActiveXObject)
{
xmlRequest=new ActiveXObject("microsoft.xmlHttp");
}
}
//ºÍ·þÎñÆ÷½¨Á¢Á¬½Ó
function search()
{
init();
var words = document.getElementById("words").value;
ajaxCoreObject.open("POST","DictServlet",true);
ajaxCoreObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajaxCoreObject.onreadystatechange = callBack;
aj ......
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 {
......
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 {
......
AjaxµÄIE»º´æÎÊÌ⣬»áÔì³ÉÓÃopenʱÓÃget·½·¨²»ÄÜÖظ´Ìá½»,µ¼Ö»ñÈ¡²»µ½ÊµÊ±µÄÐÅÏ¢¡£½â¾öµÄ°ì·¨ÓÐÒÔϼ¸ÖÖ£º
1.¿Í»§¶ËÔÚurlºóÌí¼ÓËæ»úÊý.
new Date().getTime()»òÕßMath.Random()
»òÕßËÍÇëÇóÇ°¼ÓÉÏ
XMLHttpRequest.setRequestHeader("If-Modified-Since","0")
2.»òÕßÓÃpost·½·¨Ìá½»
3.·þÎñÆ÷¶Ë½ûÓûº´æ.
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0); ......
ÕâÀïҪ˵µÄûÓдóµÀÀí£¬Ã»ÓÐÔÀí£¬Ã»ÓиßÉîµÄ¼¼Êõ£¬Ã»ÓÐYY£¬Ö»ÊÇ×Ô¼ºµÄÒ»´Î¾Àú£¬ÈռǶøÒÑ¡£ÒÔ·ÀÒÔºóÍü¼ÇÁË£¬ÏÖÔÚдÏÂÀ´¿ÉÒÔ×÷Ϊ²Î¿¼¡£
ʱ¼ä£º5ÔÂÑ×ÈȵÄÒ»Ìì
µØµã£º3Â¥
ÈËÎÎÒ£¬µçÄÔ
½á¹û£ºÄ£ÄâÒ»¸öÍøÕ¾µÄ¾Ö²¿Ë¢Ð¹¦ÄÜ
ÉùÃ÷£ºÐÂÊÖ£¬¶ÔAjaxµÚÒ»´ÎʹÓÃ
¼òµ¥µÄ¹¦ÄÜ£º
ûÓÐÓÃϵͳ×Ô´øµÄ¿Ø¼þ£¬ÒòΪÊÔÁ˺ܾÃû¹ÜÓã¬ÍøÉϵÄÈ«ÊÇN¼¶Áª¶¯µÄ¾Ö²¿Ë¢Ð£¬ÎÒÕâÀïÓò»ÉÏ£¬Ö»ºÃÕÒ±ðµÄ·½·¨¡£
µÚÒ»²½£º¿ÉÒÔ´Ó±ðÈË»òÍøÉϸ㵽Ajax.dllÎļþ£¬Ìí¼Óµ½binÎļþ¼Ð£¬Ìí¼ÓÒýÓá¡
µÚ¶þ²½£º´ò¿ªcsÎļþ£¬¸ù¾Ýʵ¼ÊÇé¿ö¸ü¸Ä¡¡_Default
protected void Page_Load(object sender, EventArgs e)
{
//×¢²á¡¡Ajax
Ajax.Utility.RegisterTypeForAjax(typeof(_Default));
//¿ÉÒÔÏÔʾһÏÂʱ¼ä£¬¼ì²âÓÐûÓÐÕûҳˢÐÂ,Èç¹ûµã°´Å¥Ê±¼ä±äÁ˾ÍÊÇ
¡¡¡¡¡¡¡¡//ÕûҳˢУ¬µÃÐ޸ijÌÐò£¬Èç¹ûû±ä¾Í³É¹¦ÁË¡£
Response.Write(DateTime.Now);
}
µÚÈý²½£ºËæ±ãдһ¸öº¯Êý
//µ÷Óá¡Ajax ·½·¨
[Ajax.AjaxMethod]
public string map_jiaotong()
{
//ÄãµÄ¹¦ÄÜ´úÂë
}
µ ......
ÎҵĴºÇï³ÕÃεڶþ²½£º
дһ¸ö ͨÓÃµÄ ¶ÔÏó ÁÐ±í £¬»¹ °üº¬ ËÑË÷ºÍ ÊôÐÔ¹ýÂË¡£
¾ßÌåµÄЧ¹ûÊÇ£º
µ±Ð ҵÎñ Ìí¼ÓÒ»¸ö ±íµÄʱºò£¬Ö»ÐèÒªÔÚ ¶ÔÏóÄ£ÐÍÀïµÄ Ìí¼ÓÒ»¸ö model
ºǫ́¼¸ºõ²»Ðèд´úÂë¡£
(ÎÒÊǺǫ́£º¼¤¶¯ÈËÐÄ£¡)
µ÷ÓõĶÔÏ󣬵ڼ¸Ò³£¬ÊôÐ﵀ ¹ýÂË ºÍËÑË÷È«ÊÇ Ç°Ì¨µÄAjax²ÎÊý¿ØÖÆ
(ÎÒÊÇǰ̨£º#$!@#$%$^#$%# )
ÏÂÃæ˵˵ÎÒµÄ˼·°É£º
1.ǰ̨·¢³öÇëÇó дÃ÷ µ÷ÓÃµÄ modleName ºÍ һЩÊôÐÔ µÄ¹ýÂË
È磺Author like,1
ModelName
Article ËÑË÷×÷Õß °üº¬ 1 ¶ÔÏóÃû ÎÄÕÂ
2.ºǫ́½ÓÊÜ ´¦Àí´«µÝµÄ²ÎÊý
3.¸ù¾Ý ¶ÔÏóÃû µ÷Óà ¶ÔÏó ²¢¹ýÂË
4.¸ù¾Ý ¶ÔÏóÃû ·µ»Ø ¶ÔÓ¦ Ò³Ãæ
1.ǰ̨JS ´úÂë
ǰ̨´úÂë
//================================================
//ºǫ́ÈÎÒ» ÀàÐÍ Áбí
//================================================
function AjaxForList(duixiang, pageid) {
var searchWords = $("#SearchWords").val();
var searchType = $("#SearchType").val();
var channelId = $("#list").val();
var IsRecycle = $("#IsRecycle").attr("checked");
//ÅÅÐòÃû
var sortName = "Crea ......
×ܼǼÊý:703; ×ÜÒ³Êý:118; ÿҳ6 Ìõ;
Ê×Ò³ ÉÏÒ»Ò³ [1] [2] [3] [4] 5
[6] [7] [8] [9] [10] ÏÂÒ»Ò³ βҳ