日期:2014-05-17 浏览次数:20484 次
<!DOCTYPE html> <html lang ="en"> <head> <title>AJAX</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="assets/css/bootstrap.css"> <!--@jQuery--> <script type="text/javascript" src="assets/jQuery/jQuery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button#jqb1").click(function(){ var un = $("input#username").val(); $.post("AJAX", {username:un}, function(result){//I can't make $.get() work...and $.post() can't work, too... $("p#jqp1").html(result); }); }); </script> </head> <body> <form>//去掉form即可正常工作 <input type = "text" id = "username"/> <button id="jqb1" class="btn">check username</button> <br/> <p id = "jqp1"></p> </form> </body> </html>
$(document).ready(function(){ $("button#jqb1").click(function(){ var un = $("input#username").val(); $.post("AJAX", {username:un}, function(result){//I can't make $.get() work...and $.post() can't work, too... $("p#jqp1").html(result); }); });