AJAX ??
Ajax? ???? ?? ?? Web 2.0? ????? ?? ??? ?????. Web 2.0??? ??? ??? ?? "Web 1.0?? ??????"?? ???? ???. ???? Web 1.0? ???? ??? ???? ???? ??? ?? ?? ? ?? ??? ???? ???? ?? ?????. ?? ??, hdu.edu.cn ????? ???? ??? ?????. ??? ??? ???? ??? ????? ?????. ??? ?? ??? ???? ??? ??? ??? ? ?? ??? HTML ??????. ??? ? ????? ? HTML? ???? ?? ?? ? ????? ??? ??? ? ????. ??? ??? ??? ???? ?? ? ????? ???? ?????.
Web 2.0? (???) ??? ?? ?? ?? ?? ??? ?????. ?? ?? Google ????? ?????? ?? ???? ??? ????? ?? ? ??? ? ????. ?? ??? ??? ??? ??? ? ??? ??? ????. ????? ??? ?? ???? ???? ??????? ?? ?????. ? ??? ??? ????? ???? ? 2.0? ??? ? ?? ?? ????.
???? ? ?? ??? ??? ?? ??? ??? ???? ???????. ??? ??? ?? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ?? ? ??/?? ?? ??? ?? HTML ?? ??????. ??? ??? ??? ??? ??? ?? HTML ??? ?? ??? ???? ????? ?? ??? ????? ?? ?????. ?? ? HTML ???? ???? ?? ??? ??? ???? ? ???? ??? ? ????.
??? ???? ????? ?? ???? ????? ?????, ??? ?????, ?? ???? ???? ????. ??? ?? Ajax ? Web 2.0 ??? ???? ?? HTML ???? ?????? ??? ???? ??? ?? ? ????. ????? ?? ??? ??? ???? ?? ? ??? ???? ??????? ??? ???? ???? ??????? ??? ???? ?? ???? ???.
Ajax? ??????
1. ?? ??: Asynchronous, JavaScript, And, XML(??? JavaScript ? XML)
2.Ajax? ??? ??? ??????. ?? ??? ??? ?? ?? ??? ?? ?? ??? ???? ???
3
??: ? XHTML ? CSS documentObjectModels? ???? ???? ???? ?? ?????. Ajax?? ?? ??? ?? ??? ????. 3. ? ????? ??? ?????. (????? ???? ??? ?? ?? ???? ???? ?? ??) 4. ?? ? ???(??? ?? ??? ?????? ???) 1. XMLHttpRequest ??(?: IE5 ??) 2. Ajax? ?? ?? ???? ?? ???? ??? ?? ?? ???? ?? ??? ?????. 3. ?????(?? ?? ???? ?? JS ???? ?? ???? ???? ??? ? ?? ?????). 4. ?? ? ??? ??? ?????(?? ??? ?? ??? ?? JS ?? Ajax ??? ??? ?????). Google Suggest 2005? Google? Google Suggest? ?? AJAX? ?? ?? ??????. Google Suggest? AJAX? ???? ?? ??? ? ?????? ????. Google ???? ???? ???? JavaScript? ?? ??? ??? ??? ??? ?? ?? ??? ?????. ?? ?: ?? html ?? ???: txt.php ?? ???:
??? ?? ?? ? ??? XML ? XSLT? ?????.
??? ???? XMLHTTPREQUEST? ???? JavaScript? ???? ?????. :
? ????? ? ????? ???? ???? ? ?????? ?? ?????. ? ??? ?? ???. ??? ???? ?? ?? ????? ????? ?? ???? ??? ? ???? ???? ????? ? ????. Ajax? ???? ?? ???? ??????? ??? ????? ???? ??? ???? ??? ? ??? ?????? ?? ? ????.
1. ???? ??? ???? ????(?? ???? ? JavaScript? ????? ????? ??). (???? ?? ??? ??? ???? ??? ???? ?? ? ????.)
Ajax? ??? ??? ????. <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
function checkname(){
if($('#name').val() == ""){
$('#msg').html("please enter the name!");
$('#name').focus;
return false;
}
if($('#address').val() == ""){
$('#msg').html("please enter the address!");
$('#address').focus;
return false;
}
ajax_post();
}
function ajax_post(){
$.post("txt.php",{name:$('#name').val(),address:$('#address').val()}, //url鏈接txt.php
function(data){
//$('#msg').html("please enter the name!");
//alert(data);
$('#msg').html(data);
},
"text");
}
</script>
</head>
<body>
<form id="ajaxform" name="ajaxform" method="post" action="txt.php">
<p>
姓名:<input type="text" name="name" id="name"/>
</p>
<p>
地址:<input type="text" name="address" id="address"/>
</p>
<p id="msg"></p>
<p>
<input name="Submit" type="button" value="submit" onclick="return checkname()"/>
</p>
</form>
</body>
</html>
<?php
$name = $_POST["name"];
$address = $_POST["address"];
echo $name."<br>";
echo $address."<br>";
?>