不适用内函数或者promise的方式,可以在外部提取到json数据

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script>
function createXHR(){
var xhr = null;
if(window.XMLHttpRequest){
xhr = new XMLHttpRequest();
}else if(window.ActiveXObject){
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
return xhr;
} function test1(){
var xhr = createXHR();
xhr.open('GET','http://localhost/firstphp/js/SiteGPS.js',true);
xhr.onreadystatechange = function(){
if(this.readyState == 4){
alert(this.responseText);
}
}
xhr.send(null);
}
</script>
</head>
<body>
<input type="button" value="更新歌曲" onclick="test1();">
<div id="lists"></div>
</body>
</html>

最新文章

  1. 第3章 拍摄UFO——单一职责原则
  2. jQuery-1.9.1源码分析系列(六) 延时对象
  3. pushState()、popstate事件配合ajax实现浏览器前进后退页面局部刷新
  4. 浅析Android中ndk-build支持的参数
  5. 使用Spring MVC统一异常处理实战
  6. Starship Troopers
  7. mysql 数据备份还原
  8. mysql---字符集详解
  9. 动作-CCActionInterval之CCGridAction家族
  10. Appnium+python实现手势密码为什么总是报错
  11. python运维开发(十七)----jQuery续(示例)web框架django
  12. hdu 1978 How many ways(dp)
  13. UIView 设置阴影(属性说明)
  14. 怎样在万网加入Lync Online SRV记录
  15. python之numpy库[1]
  16. Jenkins关于tomcat地址和端口映射的配置
  17. 关于jquery插件模板的两个案例
  18. 老版本db2这里下
  19. Echarts的一些总结
  20. 【转】解决ubuntu13.10下,无法双击运行脚本文件

热门文章

  1. 使用Android Studo开发NDK之Gradle的配置(能debug C代码)
  2. 构建基于Javascript的移动CMS——生成博客(二).路由
  3. 每一个程序猿都须要了解的一个SQL技巧
  4. #定位系统性能瓶颈# perf
  5. mysqli数据库操作简单实例
  6. nyoj--74--小学生算术(水)
  7. Electron 问题
  8. maridb Error &#39;Operation DROP USER failed for
  9. 页面加载通过javascript来修改控件属性
  10. 编程范式(Programming Paradigm)-[ 程序员的编程世界观 ]