doushenmao9036 2016-01-25 21:51
浏览 31
已采纳

如何在HTML页面中包含一个苗条的api?

I have created a slim api. It fetches the db items and displays it. Now how do i include it in a html page? This is the api route

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

          });

This is the html page where i want to insert the api.

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

1条回答 默认 最新

  • dongxu0690 2016-01-26 08:29
    关注

    After some tries i have found the solution for this. Use the script to call the api route. It is working fine.

    <script>
    $( "#view" ).load( "http://localhost/login/user_table/001" );
    </script>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部