gpt4 book ai didi

jquery - $(document).ready() 未针对 ajax 加载的内容执行

转载 作者:行者123 更新时间:2023-12-03 22:45:03 24 4
gpt4 key购买 nike

在返回的部分页面中不执行 document.ready 的原因可能是什么?两次工作正常,但第三次更新 html 后没有任何反应:

alert(html);
alert($(PopUpItem));
$(PopUpItem).html(html);
alert('in set popup html completed');

我已执行所有警报,PopupItem 和 html 具有正确的值。我正在使用 JQuery 通过 $.post 执行服务器调用。

此外,如果发生某些语法错误,我可以使用错误处理程序来捕获吗?

最佳答案

在返回的 AJAX 中,您不需要 $(document).ready() 调用。 DOM 已经加载。像这样简单的事情应该可以解决问题:

<script type="text/javascript">
// Do something here.
</script>

关于jquery - $(document).ready() 未针对 ajax 加载的内容执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2200540/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com