zoukankan      html  css  js  c++  java
  • ajax禁止浏览器缓存

       把cache 设置为false ,把 ifModified 设置为true

    //工作计划
    function workprogram(date_time){
        $.ajax({
            async:false,
            url : 'selectMessageByDate',
            data :
            {  
                date_time : date_time
            },
            dataType : 'json',
             cache:false,        //这里
             ifModified :true , //这里
            success : function(data){
                var morning="";
                var noon="";
                var night="";
                 var n1 = "";
                 var n2 = "";
                 var n3 = "";
                 var n4 = "";
                var wordList = data[0];
                var forcastList = data[1];
                for(var i in wordList){
                    var time = wordList[i].date_time;
                    var type = wordList[i].type;
                    var mess = wordList[i].message;
                    if(type=="0"){
                        morning=mess+" ${morning} "+time;
                    }else if(type=="1"){
                        noon=mess+" ${noon} "+time;
                    }else if(type=="2"){
                        night=mess+" ${night} "+time;
                    }
                }
                
                for(var i in forcastList){
                    var str = forcastList[i].observTimes;
                    var sitiId = forcastList[i].siteId;
                    var bulbTemp = forcastList[i].bulbTemp;
                    var precipitationAmount = forcastList[i].precipitationAmount;
                    var windV = forcastList[i].windV;
                      str=str.substring(8);
                     str=str.substring(0,2);
                    
                    if(str=="00"){
                        if(sitiId=="54338"){//盘山
                            n1 = bulbTemp+" "+"${mpt}"+" "+precipitationAmount+" "+"${mpr}"+" "+windV+" "+"${mpw}";
                        }else if(sitiId=="54470"){//大洼
                            n2 = bulbTemp+" "+"${mdt}"+" "+precipitationAmount+" "+"${mdr}"+" "+windV+" "+"${mdw}";
                        }
                    
                    } else if(str=="12"){
                            if(sitiId=="54338"){
                                n3 = bulbTemp+" "+"${npt}"+" "+precipitationAmount+" "+"${npr}"+" "+windV+" "+"${npw}";
                            }
                            else if(sitiId=="54470"){
                                n4 = bulbTemp+" "+"${ndt}"+" "+precipitationAmount+" "+"${ndr}"+" "+windV+" "+"${ndw}";
                            }
                        }
                }
                
                replaceWord(morning+","+noon+","+night+";"+n1+","+n2+","+n3+","+n4+";"+date_time);
            }
            
        });

    }

  • 相关阅读:
    c# 在WebBrowser中用SendMessage模拟鼠标点击
    R 脚本读取汇总 Excel 表格数据
    lsyncd —— 多机器实时同步文件神器
    gops —— Go 程序诊断分析工具
    【读书】《跟任何人都聊得来》
    Monkeyrunner自动化测试由浅入深(第一节)
    【读书】《优秀到不能被忽视》
    【管理提升】360管理沟通的学习收获总结
    【读书】《不懂说话你怎么带团队》
    软件测试行业现状 2018年度报告
  • 原文地址:https://www.cnblogs.com/guolsblog/p/6000482.html
Copyright © 2011-2022 走看看