index.html??碼:
<html>
<head>
<meta?charset="utf-8">
<script?src="jquery-1.12.4.min.js "></script>
<script?type="text/javascript">
?
????$(function?()?{
????????$("#btn").click(function?()?{
$.ajax({?
??????????????????????:"???",?
?????????????????url:"form.php",?
?????????????????????:{
???????????????????????? ??:$("#bookname").val(),
????????????????????????:$( "#press").val()
???????????????????},
????????????????? ???:?true,
?????????????????? ??:?function(msg)?{?
??????
????????});
????});
???
</script>
</head>
<body>
????<div?style="text- ??:????; ?? ?? :?50px;">
????????<form?id="form1">
????????????圖書name:<input?type="text"?id="bookname"?/><br>
????????? ???: <input type="text" id="press" style="margin-top: 15px;" /><br>
????????????????????????????????????????????????~??????????????????????????????????????????????="??" style="margin-top: 27px;" >>?????????????????????
form.php ??:
<?php
$a = $_POST["bookname"];
$b = $_POST["press"];
echo $a;
echo $b ;
?>
index.html? ???? ??? ??? ? ??? ?????.
form.php ???? ??? ?? ?? ??? ?????. ??? ??? ? ????.
????? ??? ??? ????.
1 ???? ???? ?? ajax? ?? ??? ?????.
??? ?? ????? ?????? ???