jQuery - run a function from another page

后端 未结 3 1821
死守一世寂寞
死守一世寂寞 2021-01-07 12:50

I have a account page with links that load the pages with the .load. I am wondering how I can get to the load account info page from another page (not from the account page

3条回答
  •  难免孤独
    2021-01-07 13:28

    JavaScript runs in the browser and so no you won't be able to call it remotely. You will need to have access to the same script on your "other page" and add the loadAccountInformation function as a click handler to the link in the same way you do on the accounts page.

    If you want to run the function once you arrive on the accounts page from the other page then you can call it once the page has loaded. Something like...

    $(function () {
      loadAccountInformation();
    });
    

提交回复
热议问题