jquery ajax用POST提交问题。
前台:<!DOCTYPEHTML><html><head><scripttype="text/javascript"src="jquery.js"></script><s...
前台:
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#test").keyup(function(){
$$("#txtHint").ajax({
type:"POST",
url:"gethint.php",
data:"q="+$.trim($("#test").val());
});
;
});
</script>
</head>
<body>
<p><b>Start typing a name in the input field below:</b></p>
First name2: <input type="text" id='test'>
</form>
<p>Suggestions: <span id="txtHint"></span></p>
</body>
</html>
后台:
<?php
// Fill up array with names
//get the q parameter from URL
$_POST["q"];
//output the response
echo $_POST['q'];
?> 展开
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#test").keyup(function(){
$$("#txtHint").ajax({
type:"POST",
url:"gethint.php",
data:"q="+$.trim($("#test").val());
});
;
});
</script>
</head>
<body>
<p><b>Start typing a name in the input field below:</b></p>
First name2: <input type="text" id='test'>
</form>
<p>Suggestions: <span id="txtHint"></span></p>
</body>
</html>
后台:
<?php
// Fill up array with names
//get the q parameter from URL
$_POST["q"];
//output the response
echo $_POST['q'];
?> 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询