我正在使用 AJAX 从使用 Php 的 MSSQL Server 2017 检索数据,并在文本框中显示这些值。一个 MSSQL 查询给出,但其他没有。在data.php 中,当$stmt此处等于时SELECT rmtype FROM rmmaster,数据正在加载到AJAX.php 中的文本框,但当$stmt此处等于时SELECT * FROM rmmaster where rmnumber='102'没有值。但是,如果在 sql management studio 中运行这两个查询,则两者都在工作并有结果。
连接没有错误,只是这对一个而不是另一个起作用。
这是 AJAX.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<button type="button" id="element" class="element">Button</button>
<input type="text" class="form-control" id="usr">
</div>
</body>
<script type="application/javascript">
$('#element').on('click', function(e){
$.ajax({
url: …Run Code Online (Sandbox Code Playgroud)