The first method is using XHR (XMLHttpResquest) call. XHR allows the script to open up a http connection to the server and send in a GET or POST request. One limitation is that the request could only go to the same domain as the script.
The second method is to create a script element in DOM. This causes the browser to download the js file which could be formulated to contain data. This method allow to access data in another domain. However, there may pose a security risk as the js file could be downloaded by others.
No comments:
Post a Comment