Pau*_*aul 0 javascript php jquery
是否可以知道何时使用location.href加载页面?我当前的代码看起来像这样,我希望在我的页面加载完成后触发一些事件.我尝试使用$ .get但它破坏了我当前的jquery地址实现,所以这不起作用.
$('.search').click(function(){
location.href = "/search.php";
// trigger event here...
return false;
});
Run Code Online (Sandbox Code Playgroud)
这不适用于我当前的设置:
$.get('search.php', function() {
alert('Page has finished loading');
});
Run Code Online (Sandbox Code Playgroud)
还有其他选择吗?
你试过这个:
$(document).ready(function () {
alert('Page has finished loading');
});
Run Code Online (Sandbox Code Playgroud)
编辑:删除了答案的第二部分,因为有目的的重定向否定了它的有用性