我是 jQuery 新手,正在尝试从我发现使用 AJAX 的网站复制一个示例,我需要获取 PHP 变量并将其传递到另一个 PHP 页面,而不刷新整个页面。我在下面提出了以下代码,但出现语法错误
Uncaught SyntaxError: Unexpected token )
这是我的代码:
$("Button").click(function(){
var textBox = $("textBox").val();
$.post("script.php",
{textBox: textBox},
function(data,status)
)};
)};
我的 PHP 页面:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<script type='text/javascript' src='script.js'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></$
<title>LCD Display</title>
</head>
<body>
<form id="lcd" action="script.php" method="post">
<input name='textBox' type='text' />
<input type='submit' id= 'Button' value='Press to see something cool'/>
</form>
<div id='ResponseDiv'>
</div>
<iframe id="video" src="http://192.168.0.11:8081" height="120" width="160"></iframe>
</body>
</html>
我也收到以下错误,但我认为它们可能与语法错误有关:
Resource interpreted as Document but transferred with MIME type multipart/x-mixed-replace: "http://192.168.0.11:8081/".
Resource interpreted as Document but transferred with MIME type image/jpeg: "http://192.168.0.11:8081/".