How can I execute a script after calling [removed].href?

前端 未结 8 1465
执笔经年
执笔经年 2020-12-03 10:48

I have a script that redirects the user to another page. I want to load some content into a div on the new page after the new page has fully loaded. How can I do this. The f

8条回答
  •  一向
    一向 (楼主)
    2020-12-03 11:00

    You should just run

    $('.my_class').load('my/url/path/with/content/to/load');
    

    on this page: http://www.mypage.com/info.

    When you do window.location.href = 'http://www.mypage.com/info'; you're redirecting to another page. Nothing after that line will happen. You have to instead run the code after that line on the page that's loaded.

提交回复
热议问题