我需要在JavaScript中执行HTTP GET请求.最好的方法是什么?
我需要在Mac OS X dashcode小部件中执行此操作.
我在我的网络应用程序http://localhost/foo.txt的根目录中有一个文本文件,我想将它加载到javascript中的变量..在groovy中我会这样做:
def fileContents = 'http://localhost/foo.txt'.toURL().text;
println fileContents;
Run Code Online (Sandbox Code Playgroud)
如何在javascript中获得类似的结果?