1.json

{
    "current": 2,
    "result": "success"
}

1.html

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(function(){
    $("#BTN1").click(function(){
        $.ajax({
            url: "1.json",
            dataType: "json",
            success: function(data){
                if(data === undefined){return false;}
                alert(data.current);
                alert(data.endPage);
            }
        })

    });


});
</script>
</head>
<body>
<h1>调用静态json例子</h1>
<input type="button" value="BTN1" id="BTN1">
</body>
</html>

 

相关文章:

  • 2021-10-28
  • 2021-10-28
  • 2021-11-20
  • 2021-10-26
  • 2021-10-31
  • 2022-01-12
  • 2021-04-26
  • 2021-11-13
猜你喜欢
  • 2022-02-19
  • 2022-12-23
  • 2022-01-05
  • 2022-01-02
  • 2021-08-16
  • 2022-12-23
  • 2021-05-31
相关资源
相似解决方案