这是我的第一篇文章。我是使用AJAX但尝试学习的新手。我有一个应用程序向用户显示他们的打开故障单(一切正常)。我在表格中有一个链接可以触发下面的功能,但是没有任何事情发生。
function loadTicketDetails(ticketNumber) {
var loadingBar = document.getElementById('loadingArea');
var ticketDetails = document.getElementById('ticketDetails');
if (ticketDetails.style.display != 'block') {
ticketDetails.style.display = 'block';
}
if (ticketDetails.style.display != 'inline') {
loadingBar.style.display = 'inline';
}
loadingBar.style.display = 'inline';
if (document.getEleme)
$.ajax({
url: "ticketdetails.inline.php?ticketNumber=" + ticketNumber,
dataType: "text/html",
success: function(data) {
$(".ticketDetails").html(data);
}
});
if (ticketDetails.style.display != 'none') {
loadingBar.style.display = 'none';
}
}
我觉得我可能错过了一些明显的东西,但任何帮助都会受到赞赏。
供参考,这里是ticketdetails.inline.php?ticketNumber = ticketNumber应该返回:
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading"><span id="ticketTitle"><?echo $ticketTitle; ?></span><Span style="float: right; display: inline; cursor: pointer;" onClick="closeTicketPanel();">Close</Span></div>
<div class="panel-body">
<p><strong>Ticket Number:</strong> Ticket Number</p>
<p><strong>Ticket Status:</strong> Ticket Status</p>
<p><strong>Ticket Description:</strong> </p>
<p>ERMAGERD, MY COMPOOTER IS BURNING</p>
<br /><br />
<p><strong>Ticket Notes:</strong></p>
<table width="100%" border="1">
<tbody>
<tr>
<th width="693" style="text-align: left;">
<strong>Note Title: </strong>Important ticket note
<strong>Date</strong>: 2017-04-25 15:52
<strong>Author:</strong> Jimmy John</th>
</tr>
<tr>
<td>Important ticket note</td>
</tr>
<tr>
<th width="693" style="text-align: left;">
<strong>Note Title: </strong>Task Notes
<strong>Date</strong>: 2017-04-25 16:01
<strong>Author:</strong> Jimmy John</th>
</tr>
<tr>
<td>Task Notes</td>
</tr>
<tr>
<th width="693" style="text-align: left;">
<strong>Note Title: </strong>Task Detail
<strong>Date</strong>: 2017-04-25 16:02
<strong>Author:</strong> Jimmy John</th>
</tr>
<tr>
<td>Task Detail</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>