摘要:jquery ajax 傳二個參數
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
<script src="jquery-1.2.6.pack.js" ></script>
<script type="text/javascript">
$(document).ready(function(){
$('#offer').click(function(){
var postdate = $("#postdate").val();
var money = $("#money").val();
$.ajax({
type: "post", //這裡因該是post不是get
data: {
key1: postdate,
key2: money
},
url: 'ajax2.php',
dataType:"html",
cache: false,
success: function(data) {
$('#result').html(data);
}
});
});
});
</script>
</head>
<body>
<input type="text" name="postdate" id="postdate" >
<input type="text" name="money" id="money" >
<input type="button" name="offer" id="offer" value="送出" />
<div id=result></div>
</body>
</html>