post

English [p??st] US [po?st]

n. ??, ??, ??, ?? .??(?? ?? ?? ?????? ??)? ???? ?? .〈?〉 ???? [???]

??? ???() ??? ???

??: post() ???? HTTP POST ??? ?? ???? ???? ?????.

??: ??jQuery.post(url,data,success(data, textStatus, jqXHR),dataType)

????:

ParametersDescription
url ?????. ??? ??? ?? URL? ?????.
??? ????. ? ?? ??? ?. ??? ?? ??? ??? ???? ?????.
??(???, ?????, jqXHR)????. ??? ???? ? ???? ?? ?????.
dataType ????. ???? ?? ??? ??? ??? ?????. ??? ??? ?????(xml, json, script ?? html) ?????.

??: ? ??? ??? ?? ??? Ajax ?????. $.ajax({ type: 'POST',url: url,data: data,success: Success,dataType: dataType}); ??? MIME ??? ?? ?? ?? ??? ???? ?? ???? ????. ??? ???? XML ?? ??, ??? ???, JavaScript ?? ?? JSON ??? ? ????. ?? ?? ??? ?? ??? ??? ??? ??? ?? ????. jQuery 1.5??? jqXHR ??? ?? ?? ??? ??? ?? ????(jQuery 1.4??? XMLHttpRequest ??? ?????). ???? ????? ?? ??? ?????. $.post("ajax/test.html", function(data) {$(".result").html(data);}) ? ???? ??? HTML? ????. ???? ???? ???? ?????. POST? ?? ?? ???? ???? ???? jQuery.ajaxSetup()? ?? ? ifModified ??? ??? ??? ??? ??? ????.

??? ???() ??? ?

<!DOCTYPE html>
<html>
<head>
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $.post("",
    {
      name:"Donald Duck",
      team:"Duckburg"
    },
    function(){
      alert("數(shù)據(jù):" + "Donald Duck" + "\n狀態(tài):" + "Duckburg");
    });
  });
});
</script>
</head>
<body>
<button>向頁面發(fā)送 HTTP POST 請求,并獲得返回的結(jié)果</button>
</body>
</html>
???? ?? ?

??? ????? ??? "???? ??" ??? ?????