weixin_33727510 2016-05-17 16:30 采纳率: 0%
浏览 18

正在加载下一篇文章

I am trying to load the next post on my website but once I click it says post not found. My code is below

<script>
$(document).ready(function(){
    $("button").click(function(){
        $.ajax({url: "{$baseurl}/view/{$p.key}", success: function(result){
            $("#haha").html(result);
        }});
    });
});
</script>

$p.key is the key of the post or id which is being loaded from the key column in the posts table.

The idea is to load the next id each time I click on the button.

  • 写回答

1条回答 默认 最新

  • 程序go 2016-05-17 16:33
    关注

    Do you want to use template strings?

    <script>
    $(document).ready(function(){
        $("button").click(function(){
            $.ajax({url: `${$baseurl}/view/${$p.key}`, success: function(result){
                $("#haha").html(result);
            }});
        });
    });
    </script>
    
    评论

报告相同问题?