我在我的速度宏模板之一中使用jQuery(即将加载最后一个的内容页脚)。jQuery脚本必须在ajax调用后运行
此脚本适用于除一页之外的所有页面。在该页面上,页面完全呈现后,将表插入页面中间的。所以我尝试使用onload函数,仍然没有运气。
<table id="ArtifactListTable" class="ItemListTable">
<!-- this table is inserted after ajax request -->
<script>
window.onload = function() {
jQuery('.priority1').text('P1');
jQuery('.priority2').text('P2');
jQuery('.priority3').text('P3');
jQuery('.priority4,.priority5').text('None');
jQuery('.priority4,.priority5').addClass('priority0').removeClass('priority4 priority5');
};
</script>
我需要这个AJAX负载功能(我有过阿贾克斯没有控制)后运行我的jQuery。我只能处理我的jQuery。
分享ajax负载如何用于加载表 –
jQuery ajax调用有一个'成功'回调 - 提供一个函数完成上述操作,并将其设置为您的ajax调用的成功回调函数。 – sje397
如果您可以访问由jQuery Ajax调用(http://api.jquery.com/jQuery.ajax/)返回的jqXHR对象,那么您可以附加一个.done()函数,它将在运行后它已经完成(或者如果你想运行它,即使它失败,也使用.always())。 –