jQuery Get Request on HTTP URL

前端 未结 4 1495
耶瑟儿~
耶瑟儿~ 2020-12-29 00:54

i\'ve recently tried to get some Response from an URL using jQuery. Therefore I copied a get request sample of jQuery API Get Request Tutorial into my project and tried to r

4条回答
  •  太阳男子
    2020-12-29 01:36

    As others have said you can't access files on another server. There is a hack tho. If you are using a server side language (as i assume you are) you can simply do something like:

    http://myserver.com/google.php:

    
    

    http://myserver.com/myscript.js

    $.get('google.php',function(data){ console.log(data) });
    

    That should work!

提交回复
热议问题