Ajax(异步Java语言和XML)是一种将数据从客户端异步发送到服务器的方法。为此,您必须编写代码以使用Javascript /
HTML在客户端发送数据,还必须在服务器端使用服务器端语言(例如PHP)处理接收到的数据。
而且,是的,您不需要
<form>标签即可。
看看这个例子。
HTML:
<label>Text</label><textarea id="foo"></textarea><button id="submit">Submit via Ajax</button>
Javascript:
$('#submit').click(function(e) { e.preventDefault(); // information to be sent to the server var info = $('#foo').val(); $.ajax({ type: "POST", url: 'server.php', data: {foo: info} });});服务器端处理程序(PHP): server.php
<?php// information received from the client$recievedInfo = $_POST['foo'];// do something with this information
请参阅此作为参考http://api.jquery.com/jquery.ajax/



