zoukankan      html  css  js  c++  java
  • 每天一个随笔

    今天又重新回顾了一下,源生JS写Ajax请求。

    var xmlhttp;
    if(window.XMLHttpRequest){
      xmlhttp = new XMLHttpRequst();
    }else{
      xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
    }
    
    xmlhttp.open('GET',url,true);
    xmlhttp.send(null);
    
    xmlhttp.onreadystatechange = function(){
      if(xmlhttp.readyState==4&&xmlhttp.status==200){
        var data= xmlhttp.responseText;  //对字符串进行解析
        //var data = xmlhttp.responseXml; 对xml文件进行解析
      }  
    }

    学习到了分页缓存的使用,因为每次分页显示都要去数据库查询的话,无疑会增加增加服务器和数据库的负担,数据库查询依然会有一定反应时间。而分页缓存是将自己浏览过的分页数据存储到一个自定义的cache数组中。如果已经浏览过这个pageNo(第N页),那么便会从cache中取出数据。避免再次去查询数据库。

    最后学习了Vue.js的使用,写了几个demo。

  • 相关阅读:
    jdbc练习demo
    需登录账号与密码的网页爬取demo
    获取中文的首字母demo
    短信发送接口demo
    读取配置文件工具demo
    省选模拟96
    省选模拟95
    省选模拟94
    省选模拟92
    省选模拟91
  • 原文地址:https://www.cnblogs.com/mesopotamiazZ/p/7042762.html
Copyright © 2011-2022 走看看