你的位置:首页 > 软件开发 > Java > 【高级功能】使用 Ajax(续)

【高级功能】使用 Ajax(续)

发布时间:2016-08-18 20:00:08
1. 准备向服务器发送数据Ajax 最常见的一大用途是向服务器发送数据。最典型的情况是从 客户端发送表单数据,即用户在form元素所含的各个 input 元素里输入的值。下面代码展示了一张简单的表单:<!DOCTYPE html><html lang=&quot ...

【高级功能】使用 Ajax(续)

1. 准备向服务器发送数据

Ajax 最常见的一大用途是向服务器发送数据。最典型的情况是从 客户端发送表单数据,即用户在form元素所含的各个 input 元素里输入的值。下面代码展示了一张简单的表单:

<!DOCTYPE html><html lang="en"><head>  <meta charset="UTF-8">  <title>基本表单</title>  <style>    .table{display: table;}    .row{display: table-row;}    .cell{display: table-cell;padding: 5px;}    .lable{text-align: right;}  </style></head><body><form id="fruitform" method="post" action="http://127.0.0.1:8080/form">  <div class="lable">    <div class="row">      <div class="cell lable">Apples:</div>      <div class="cell"><input name="apples" value="5" /></div>    </div>    <div class="row">      <div class="cell lable">Bananas:</div>      <div class="cell"><input name="bananas" value="2" /></div>    </div>    <div class="row">      <div class="cell lable">Cherries:</div>      <div class="cell"><input name="cherries" value="20" /></div>    </div>    <div class="row">      <div class="cell lable">Total:</div>      <div id="results" class="cell">0 items</div>    </div>  </div>  <button id="submit" type="submit">Submit Form</button></form></body></html>

原标题:【高级功能】使用 Ajax(续)

关键词:ajax

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。