How to load page synchronously using jQuery

后端 未结 6 1107
遥遥无期
遥遥无期 2021-01-23 04:03

Currently I am using jQuery to choose what my index page should load depending whether a cookie is set.

For example, the body tag of the index.html should load hasCookie

6条回答
  •  粉色の甜心
    2021-01-23 04:51

    AFAIK, JQuery load cannot be synchronous.

    You can cet around this witha callback function.

    $(document.body).load('hasCookie.html', function(){
    //call styling script here
    });
    

提交回复
热议问题