Get file contents in java script

前端 未结 2 1591
逝去的感伤
逝去的感伤 2020-12-14 10:58

I\'ve a URL that its contents are also JavaScript codes, I want to get the contents of this URL via JavaScript something like to file_get_contents() in PHP and

相关标签:
2条回答
  • 2020-12-14 11:45

    you can get the contents from that URL by using jQuery

    $.get('website_url', function(data) {
         alert(data);
    });
    
    0 讨论(0)
  • 2020-12-14 11:58

    You can use XMLHttpRequest in Javascript to fetch datas from an external URL. Here is a good resource : http://www.w3schools.com/ajax/default.asp (I usually don't recommend them, but the AJAX tutorial is really good).

    Also, this had to be there :

    jQuery ownz

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