AJAXʹÓÃjson½âÎöÓëʹÓÃxml½âÎöµÄ±È½Ï
¹¤¾ß:myeclipse 6.5
jsonÖÐÎĹٷ½£ºhttp://www.json.org/json-zh.html
н¨ÏîÄ¿webs£¬ÔÚWebRootÏÂн¨Ä¿Â¼json
xmlµÄ½âÎö·½Ê½:
------------------------------------------------------------------
1.н¨NewFile.xml
<?xml version="1.0" encoding="UTF-8"?>
<userinfo>
<name>kava</name>
<city>wuhan</city>
<tel>88768675</tel>
</userinfo>
2.н¨xml_1.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>xml</title>
<script type="text/javascript">
var xmlHttp;
function showDetails() {
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
return;
}
var url = "http://localhost:8080/webs/json/NewFile.xml
";
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
function GetXmlHttpObject(){
var xmlHttp=null;
Ïà¹ØÎĵµ£º
µ±ÊäÈë ¡·Ê±×Ô¶¯²¹È« µ±ÊäÈë¡¶/ʱ×Ô¶¯²¹È«
“£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
" File: closetag.vim
" Summary: Functions and mappings to close open HTML/XML tags
" Uses: <C-_> -- close matching open tag
" Author: Steven Mueller <di ......
//Óû§ÃûУÑéµÄ·½·¨
//Õâ¸ö·½·¨½«Ê¹ÓÃXMLHTTPRequest¶ÔÏóÀ´½øÐÐAJAXµÄÒì²½Êý¾Ý½»»¥
var xmlhttp;
function verify() {
//0¡£Ê¹ÓÃdomµÄ·½Ê½»ñÈ¡Îı¾¿òÖеÄÖµ
//document.getElementById("userName")ÊÇdomÖлñÈ¡ÔªËØ½ÚµãµÄÒ»ÖÖ·½·¨£¬Ò»¸öÔªËØ½Úµã¶ÔÓ¦HTMLÒ³ÃæÖеÄÒ»¸ö± ......
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
......
<html>
<head>
<title>new ajax</title>
<mce:style type="text/css"><!--
body{
margin-top:50px;
}
.MyDiv{
font-size:12px;
border:1px solid #DDD;
background-color:#FFD;
margin:2px;
width:200px;
}
--></mce:style><style type="t ......