How to get data with JavaScript from another server?

前端 未结 8 605
生来不讨喜
生来不讨喜 2020-12-02 17:23

How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user\'s browser? There are limitations in place to prevent

8条回答
  •  离开以前
    2020-12-02 18:20

    Write a proxy script that forwards along the http request from your domain, this will bypass the XMLHttpRequest restrictions.

    If your using PHP, simply use cURL to request and read the page, then simply spit out the html as if it was from you domain.

提交回复
热议问题