pbootcms网站站内使用Ajax获取数据示例

<script>

$(document).ready(function (e) {

  var url='/api.php/cms/site';

  $.ajax({

    type: 'POST',

    url: url,

    dataType: 'json',

    data: {

      appid: '{pboot:appid}',

      timestamp: '{pboot:timestamp}',

      signature: '{pboot:signature}'

     },

    success: function (response, status) {

      if(response.code){

        //获取数据成功

        alert(response.data.title);

      }else{

        //返回错误数据

        alert(response.data);

      }

    },

    error:function(xhr,status,error){

      //返回数据异常

      alert('返回数据异常!');

    }

  });

});

</script>

此处使用了三个站内标签:{pboot:appid} 认证用户名、{pboot:timestamp} 时间戳、{pboot:signature} 认证签名

 

posted @   黄文Rex  阅读(17)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· 探秘 MySQL 索引底层原理,解锁数据库优化的关键密码(下)
· 大模型 Token 究竟是啥:图解大模型Token
· 35岁程序员的中年求职记:四次碰壁后的深度反思
· 继承的思维:从思维模式到架构设计的深度解析
· 如何在 .NET 中 使用 ANTLR4
阅读排行:
· BotSharp 5.0 MCP:迈向更开放的AI Agent框架
· 分享 3 款基于 .NET 开源且免费的远程桌面工具
· 在线聊天系统中的多窗口数据同步技术解密
· 2025,回顾出走的 10 年
· 设计模式脉络
点击右上角即可分享
微信分享提示