php
1 2<?php 3 //test2.php 4 echo $_POST['name']; 5 6 ?>
javascript
1コード 2<!DOCTYPE html> 3<html lang="ja" dir="ltr"> 4 <head> 5 <meta charset="utf-8"> 6 <title>TEST</title> 7 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 8 </head> 9 <body> 10 11 12 <p id="test">jQuery練習</p> 13 <input type="text" id="name" value=""> 14 <input type="button" id="button" value="ボタン"> 15 <p id="result"></p> 16 17 <script type="text/javascript"> 18 $(function(){ 19 20 $("#button").click(function(){ 21 $.post('test2.php', 22 23 { 24 name: "test"; 25 }, 26 function(data){ 27 alert(data); 28 } 29 ); 30 }); 31 }); 32 33 </script> 34 35 36 37 </body> 38</html>
このコードでalertが表示されないのですがどこが悪いですか?
回答1件
あなたの回答
tips
プレビュー