Using jQuery's “load” method on a local file

前端 未结 1 351
情书的邮戳
情书的邮戳 2021-01-23 23:11

I\'m trying to create a website where each of several pages has the same title bar -- a pretty standard problem. To load the title bar\'s HTML, I use jQuery\'s \"load\" method:<

相关标签:
1条回答
  • 2021-01-23 23:48

    Jquery ajax is limited to the same domain policy, local file or localhost file, as long as it is not the same domain as your script's hosting domain, it will not work.

    You need to enable the CORS (Cross-Origin Resource Sharing) on the remote server you are loading the file from.

    0 讨论(0)
提交回复
热议问题