Why cant I load an external resource from jQuery load method?

前端 未结 6 1256
星月不相逢
星月不相逢 2020-11-27 21:43

In the process of learning Ajax requests using jQuery, I tried to load google home page on the click of a link. So I wrote something like:

$(\"#ajax\").click         


        
6条回答
  •  -上瘾入骨i
    2020-11-27 22:25

    First of all, I have to assume that you have a very good reason to do something that a link does by default with JavaScript...

    The main reason is probably security: You can NOT access any data outside of the current domain from JavaScript.

提交回复
热议问题