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);
            }
            
        });

    }

  • 相关阅读:
    Android 主题theme说明 摘记
    Android开发 去掉标题栏方法 摘记
    安卓项目五子棋代码详解(二)
    关于 ake sure class name exists, is public, and has an empty constructor that is public
    百度地图3.0实现图文并茂的覆盖物
    android onSaveInstanceState()及其配对方法。
    关于集成科大讯飞语音识别的 一个问题总结
    android 关于 webview 控制其它view的显示 以及更改view数据失败的问题总结
    C# 解析 json Newtonsoft果然强大,代码写的真好
    c#数据类型 与sql的对应关系 以及 取值范围
  • 原文地址:https://www.cnblogs.com/guolsblog/p/6000482.html
Copyright © 2011-2022 走看看