【问题标题】:How to include a slim api in a html page?如何在 html 页面中包含一个 slim api?
【发布时间】:2016-05-02 15:44:42
【问题描述】:

我创建了一个苗条的 api。它获取数据库项目并显示它。现在我如何将它包含在 html 页面中? 这是api路由

$app->get('/login/user_table(/:username)', function($username) use ($app){
                  user_table_view($username);

          });

这是我要插入 api 的 html 页面。

<div class = "view">
<-- I want the api to be displayed here -->
</div>

【问题讨论】:

    标签: php html api routes slim


    【解决方案1】:

    经过一些尝试,我找到了解决方案。 使用脚本调用 api 路由。它工作正常。

    <script>
    $( "#view" ).load( "http://localhost/login/user_table/001" );
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-27
      • 2014-05-11
      • 2013-04-13
      • 1970-01-01
      相关资源
      最近更新 更多