ajax µÄÎÊÌâ¡£
function send_Pricerequest(url,obj)
{
http_Pricerequest = false;
if(window.XMLHttpRequest)
{
http_Pricerequest = new XMLHttpRequest();
if (http_Pricerequest.overrideMimeType)
{
http_Pricerequest.overrideMimeType("text/xml");
}
}
else if (window.ActiveXObject)
{
try
{
http_Pricerequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
http_Pricerequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{}
}
}
if (!http_Pricerequest)
{
return false;
}
http_Pricerequest.onreadystatechange = obj;
http_Pricerequest.open("GET", url, true);
http_Pricerequest.send(null);
}
function ShowResult()
{
var rText="";
if (http_Pricerequest.readyState == 4)
{
if (http_Pricerequest.status == 200)
{
rText=http_Pricerequest.responseText.replace(/^\s*/,"");
if (rText=="")
{
rText=" <div class='w'>Error </div>";
}
document.getElementById("ShowDiv")
Ïà¹ØÎÊ´ð£º
֮ǰÓöµ½Ò»¸öÎÊÌâ¡£
ÓÚÊÇ×öÁËÒÔÏÂʵÑ飺
Ò³Ãæ¼ÓÔØºó£¬Ìá½»Ò»¸öAjaxÇëÇó(ÔݳÆÎªajax1)£¬ÇëÇóµÄÏß³ÌÔÚ·þÎñÆ÷Éϱ»Ë¯Ãß10ÃëÖÓ¡£
µã»÷Ò³ÃæÉÏÒ»¸öbutton£¬´¥·¢ÁíÒ»¸öAjaxÇëÇó(ajax2)¡£
µ±Ã»ÓÐʹÓÃsession£¬ÔÚ·þÎñÆ÷δ´ ......
´ó¼ÒºÃ£¬Çë¸ßÊÖÃÇÖ¸µã
ÎÒµÄservletÎļþÊÇ£º
package com.ljc.rank.ajax;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
......
ǰ̨´úÂ룺
C# code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="tttt.aspx.cs" Inherits="tttt" %>
<%@ Register Assembly="System.W ......
AJAX´«ÊäJSONÊý¾Ý.¶ÔÓÚÖÐÎÄÈç¹ûʹÓÃUTF8±àÂë
ÎÒµÄÈÕÖ¾ÎļþÖмǼµÄ´«ÊäµÄ3¸öÖÐÎÄÈç"\u8d85\u7ea7\u798f"
ÔÚʵ¼Ê´«ÊäÖÐÊDz»ÊÇÕ¼ÓÃ18¸ö×Ö½Ú..
Ò²¾ÍÊÇ˵һ¸öÖÐÎÄʹÓÃJSON´«ÊäÔòÿ¸öÖÐÎÄÐèÒªÕ¼ÓÃ6×Ö½ ......
ajax˸ã³öÀ´µÄ¼¼Êõ°¡
µ½µ×Ôõô»ØÊ°¡£¬ÊÇ΢ÈíŪµÄÂ𣬻¹ÊÇgoogle °¡£¬»¹ÊÇÄĸöä¯ÀÀÆ÷¹«Ë¾°¡
The concept behind the XMLHttpRequest object was originally created by the developers of Outlook Web Ac ......