我使用MySQL,HTML5,jQuery和Json开发了一个工具。在我的网站上我有3张桌子,但其中一个必须换位。所以,我写这篇文章:jQuery必须等待php
$(document).ready(function() {
$('#druckerdetails').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": false,
"sAjaxSource": 'php/index_druckerdetails.php?druckername=RAGPLM002'
});
$(function() {
var table = $('#druckerdetails');
alert('Besten Dank, dass Sie isyPrint benutzen :)');
table.find('thead tr').detach().prependTo(table.find('tbody'));
var t = table.find('tbody').eq(0);
var r = t.find('tr');
var cols = r.length;
var rows = r.eq(0).find('td,th').length;
var cell, next, tem, i = 0;
var tb = $('<tbody></tbody>');
while (i < rows) {
cell = 0;
tem = $('<tr></tr>');
while (cell < cols) {
next = r.eq(cell++).find('td,th').eq(0);
tem.append(next);
}
tb.append(tem);
++i;
}
table.find('tbody').remove();
$(tb).appendTo(table);
$(table)
.find('tbody tr:eq(0)')
.detach()
.appendTo(table.find('thead'))
.children();
table.show();
});
});
与此警报所有的罚款和作品,因为PHP文件有足够的时间返回JSON的字符串。但是如果没有提示,那么JavaScript不会等待MySQL查询的php数据。因此,网站上的数据缺失。
没有警报: http://www.computerbase.de/forum/attachment.php?attachmentid=359923&d=1377067918
因此,这里的时间表(isyprint_home.js & index_druckerdetails.php): http://www.computerbase.de/forum/attachment.php?attachmentid=359927&d=1377072271
所以我必须做的是,JS文件等待直到JSON -string被返回?
感谢和我的英语不好
DeferredRender不起作用 – user2707596
所以,你需要做什么我把答案(编辑) – Guerra