zoukankan      html  css  js  c++  java
  • ajax加上随机数可以强制刷新网页

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    </head>
    <body>
    <input type="button" value="获取数据">
    <div></div>
    <script src="../jquery.js"></script>
    <script>
    $(function(){
    $("input[type=button]").click(function(){
    $.ajax({
    url: '../php/08.php?' + Math.random(),
    type: 'get',
    timeout:1000,//听架构师的
    data: {param1: 'value1'},
    success:function(data){
    // alert(data);
    $("div").text(data);
    },
    // 捕捉错误
    /*error:function(jqXHR,textStatus,errorThrown){
    console.log(jqXHR);
    console.log(textStatus);
    console.log(errorThrown);
    if(errorThrown == "Not Found"){
    alert("你请求的地址不存在");
    }
    if(textStatus == "timeout"){
    alert("请求超时");
    }
    }*/
    })
    });
    // 不管是什么错统统都提示这一个
    $(document).ajaxError(function(event, xhr, settings, thrownError) {
    alert("请求发生错误");
    });
    })
    </script>
    </body>
    </html>

  • 相关阅读:
    mouseOver与rollOver
    排序二叉树
    发展
    bitmapData
    回调与事件
    遍历舞台上所有对象
    面向对象原则
    面向对象的三大特征(个人理解)
    面向对象出现原因以及意义
    OC语言BLOCK和协议
  • 原文地址:https://www.cnblogs.com/niuniuniu/p/6378246.html
Copyright © 2011-2022 走看看