datatable插件-显示和隐藏有关行问题的更多信息:
我想在fnFormatDetails function.but中通过ajax获得更多信息,我不知道如何做到这一点。我试图将$.ajax放在fnFormatDetails函数中,但它似乎延迟了将输出传递给fnOpen函数以呈现新添加的行,因此新行是使用空(未定义)值创建的,而不是真实的信息。
我该怎么做呢?谢谢。
发布于 2011-05-01 17:52:46
AJAX中的"A“代表”异步“。当您进行$.ajax调用时,函数在服务器响应之前返回,因此是“异步”的。$.ajax()函数有一个接收服务器响应的成功回调,该回调必须完成处理服务器响应和更新页面的所有工作:
$.ajax({
url: '/where/ever',
data: data_for_the_url,
success: function(data, textStatus, jqXHR) {
/*
* This is where you use `data` to update the page.
* $.ajax will call this function when the server
* has successfully responded.
*/
}
});
/*
* When you get here, the server still hasn't responded so you can't
* update your page yet.
*/因此,将所有页面更新逻辑放在success回调函数中。
https://stackoverflow.com/questions/5847621
复制相似问题